Python Mastery
So you've learned the basics of Python programming from a tutorial, book, or introductory training course--where do you go next? Python Mastery is the ultimate course for anyone who wants to take their Python knowledge to the next level. After a brief review of language basics, this course dives into a wide variety of topics that will help you write better Python code and understand the advanced programming techniques used by libraries and frameworks. Topics include object-oriented and functional programming, metaprogramming, generators, coroutines, concurrency (threads and multiprocessing), advanced I/O handling, performance optimization, and interfacing with foreign code written in C and C++. In addition, the course discusses issues associated with Python 3 including the problem of migrating existing Python code.
Although no prior experience with the above course topics is required, it should stressed that the aim of this course is to go into significant depth on how Python works and how advanced parts of the language can be applied to practical issues in software engineering. The course content will be of particular interest to software developers working on large Python-based applications and frameworks.
Python Bootcamp is taught by David Beazley, the author of the highly-acclaimed Python Essential Reference. and frequent presenter of advanced Python tutorials at PyCon.
What You’ll Learn
Upon completion of Python Mastery, the student will be able to:
- Better understand Python's underlying object model and apply such knowledge to creating well-designed objects in their own programs.
- Understand different concurrent programming idioms including thread programming, multiprocessing, and event-driven programming.
- Interface Python with software written in C.
- More effectively use Python's built-in data types and understand their associated performance characteristics.
- Make use of functional programming idioms including closures, lazy evaluation, and partial function application.
- Use generators and coroutines to set up data processing pipelines.
- Use Python's metaprogramming features including decorators, descriptors, context managers, and metaclasses to solve common software development problems (e.g., avoid code replication, provide encapsulation, etc.)
Python Mastery SYLLABUS
| Section | Contents |
|---|---|
|
|
|
1. Python Review |
A brief review of Python basics including syntax, core datatypes, file I/O, functions, error handling, and classes.
|
2. Idiomatic Data Handling |
An introduction to various tools and techniques for effective data processing. Discusses different options for creating data structures and gives an inside look at how the built-in datatypes are put
together along with their performance and memory usage properties.
Students will also learn how to apply list, set, and dictionary comprehensions to various problems in data handling.
|
3. Classes and Objects |
An introduction to creating and using user-defined objects in Python.
Describes how to use the class statement to create new objects and presents details on various special methods that can be defined to customize object behavior. Commonly used object oriented programming techniques are also presented.
|
4. Inside the Python Object Model |
A detailed tour of how the Python object system is implemented.
Topics include the definition of objects, object representation, attribute binding, inheritance, descriptors, properties, slots, private attributes, static methods, and class methods. Also covers
important details concerning Python memory management and garbage collection.
|
5. Testing, debugging, and logging |
Coverage of how to test and debug Python programs with a focus on three major topics. First, testing Python programs with the doctest and unittest modules is described. Next, the Python
debugger and profiler are presented. Finally, the logging package is described.
|
6. Packages and Distribution |
How to organize Python code into packages and how to distribute packages to users and programmers. Covers the underlying mechanics
of how packages are put together and the distutils module for creating distributions. Also covers more advanced packaging options such as Distribute and setuptools.
|
7. Iterators, Generators, Coroutines |
The section starts with a description of the iteration protocol and moves on to practical use of generators and coroutines. A major focus on this section is on the use of generators and coroutines to set up processing pipelines, much like pipes in Unix programming.
You will see how generators and coroutines can lead to very elegant programming abstractions for processing data and how such programs can be used to process huge datafiles and streaming I/O.
|
8. Functional Programming |
Advanced details of how to program with functions in Python.
Discusses more advanced features of functions including variadic parameters, nested functions, closures, lazy evaluation, anonymous
functions (lambda), and function attributes.
|
9. Metaprogramming |
Loosely defined, metaprogramming refers to programs that are able to manipulate their own program structure (functions, classes, etc.) or
the structure of other programs as data. This section introduces and covers practical examples of Python's metaprogramming features including function decorators, class decorators, metaclasses, and context managers. A major emphasis of this section is to understand how advanced programming frameworks utilize these features to provide a more rich programming environment for their end users.
|
10. Extension Programming |
How to create C and C++ extensions to Python. Covers the absolute basics of the Python C API followed by some details on using the ctypes library and Swig code generator. A major focus of this section is on how to organize extension code so that it can more seamlessly integrate with the Python environment. Topics include memory
management, data handling, encapsulation, and common pitfalls.
|
11. Concurrent Programming with Threads |
An introduction to programming with Python threads. Starts with the basics of using the threading library and dives into a variety of more
advanced topics including a survey of how and when to use the different thread synchronization primitives, queues, deadlock avoidance, and thread debugging. Also includes detailed information
on how the Python interpreter executes programs and properties of the global interpreter lock (GIL).
|
12. Multiprocessing |
An introduction to the multiprocessing library that allows programs to distribute their work across independent processes or machines. Covers
processes, queues, pipes, connections, and process pools.
|
13. Advanced I/O Handling |
An in-depth examination of the Python I/O system including text handling, binary data handling, and different I/O models such as blocking, non-blocking, and event-driven I/O.
|
14. Python 3 |
A look at new features added to Python 3 and migration strategies.
Topics include new data processing features such a set and dictionary comprehensions, function annotations, and metaclasses. In addition, details of the 2to3 conversion tool are presented.
|
REQUIREMENTS
Students should already know how to write simple Python programs and be familiar with essential features of the language. This includes using common Python statements, data structures (tuples, lists, dicts, etc.), functions, and standard library modules. Some experience with object-oriented programming is also advised.