Advanced Python Programming

Advanced 4 days

In this course you will learn to

  • Leverage OS services
  • Add enhancements to classes
  • Code graphical interfaces for applications
  • Understand advanced Python metaprogramming concepts
  • Create easy-to-use and easy-to-maintain modules and packages
  • Implement and run unit tests
  • Create multithreaded and multi-process applications
  • Interact with network services
  • Design professional scripts
  • Query databases

Training materials

In addition to the course manual, students will receive a Python quick reference.

Suggested attendees

Students who can write simple Python scripts using basic data types, program structures and the standard Python library.

Course Outline

  • Python refresher
    • Built-in data types
    • Lists and tuples
    • Dictionaries and sets
    • Program structure
    • Files and console I/O
    • If statement
    • Built-in functions
    • User-defined functions
    • Modules and packages
    • Basic OOP
  • OS services
    • OS and OS.path modules
    • Environment variables
    • Launch external commands with subprocess
    • Walk directory trees
    • Paths, directories and filenames
    • Work with file systems
  • Dates and times
    • Basic date and time classes
    • Different time formats
    • Convert between formats
    • Format dates and times
    • Parse date/time information
  • Pythonic programming
    • The Zen of Python
    • Tuples
    • Advanced unpacking
    • Sorting
    • Lambda functions
    • List comprehensions
    • Generator expressions
    • String formatting
  • Functions, modules and packages
    • Four types of function parameters
    • Four levels of name scoping
    • Single/multi-dispatch
    • Relative imports
    • Effectively using __init__
    • Documentation best practices
  • Enhance classes
    • Class/static data and methods
    • Inheritance (or composition)
    • Abstract base classes
    • Create attributes with attr
    • Implement protocols (context, iterator, etc.)
  • Metaprogramming
    • Implicit properties
    • Globals() and locals()
    • Work with object attributes
    • The inspect module
    • Callable classes
    • Decorators
    • Monkey patching
  • Developer tools
    • Analyze programs with pylint
    • Use the debugger
    • Profile code
    • Test speed with benchmarking
  • Unit test with PyTest
    • What is a unit test
    • Create test cases
    • Write and run tests
    • Test harnesses
    • Work with fixtures
  • Binary data
    • What is binary data?
    • Binary vs. text
    • Use the Struct module
  • Database access
    • The database API
    • Available interfaces
    • Connect to a server
    • Create and execute a cursor
    • Fetch data
    • Parameterized statements
    • Use metadata
    • Transaction control
    • ORMs and NoSQL overview
  • PyQt
    • Overview
    • Qt Architecture
    • Use designer
    • Standard widgets
    • Event handling
    • Extras
  • Network programming
    • Built-in classes
    • Use requests
    • Grab web pages
    • Send email
    • Work with binary data
    • Consume RESTful services
    • Remote access (SSH)
  • Multiprogramming
    • The threading module
    • Share variables
    • The queue module
    • The multiprocessing module
    • Create pools
    • About async programming
  • Scripting for system administration
    • Run external programs
    • Parse arguments
    • Create filters to read text files
    • Logging
  • Serializing data
    • Work with XML
    • XML modules in Python
    • Get started with ElementTree
    • Parse XML
    • Update an XML tree
    • Create a new document
    • About JSON
    • Read JSON
    • Write JSON
    • Read/write CSV files
    • YAML, other formats as time permits
  • Advanced data handling [as time permits]
    • Discover the collections module
    • Use defaultdict, Counter and namedtuple
    • Create dataclasses
    • Store data offline with pickle
  • Type hinting [as time permits]
    • Annotate variables
    • Learn what type hinting does NOT do
    • Use the typing module for detailed type hints
    • Understand
    • Write stub interfaces

  • Any Windows, Linux or macOS operating system
  • Python 3.x installed (Anaconda bundle recommended)
  • An IDE with Python support (PyCharm Community Edition is an excellent free option, but there are several other good ones)

Python logo

You may also be interested in

Introduction to Python Programming

Learn more about this course