Abstract
This tutorial will explore some of the more tricky language features in Python --- primarily generators, decorators and context managers --- which can be used to make code shorter, easier to read, and in some sense simpler, leading to better programs. Presented techniques will be demonstrated on short samples of realistic code.
Target Audience -- intermediate Python programmers
Prerequisites -- exception handling and object-oriented-programming features of Python
Software requirements -- just Python
Generators
- Definition and some examples
- Passing information into the running generator
Decorators
- Rationale and syntax for decorating functions
- Signature changing and signature preserving decorators
- Decorators implemented as classes and as functions
- Examples of sensible real-world uses
Context managers
- What is a context manager and how it is used
- Rationale for using context managers instead of explicit techniques
- Defining context managers as generators






