Iteration in Python: Iterators, Generators, itertools, and Special Methods
- Introduction: Iteration in Python
- The benefits of Python's iteration
model
- How Python interprets a for loop
- Special methods
- Defining __iter__ for an illustrative Queue class
- Simplifying iterator definitions with generators
- Improving Queue.__iter__ by using a generator
- itertools
- Combining it all, or, merged: a class for combining containers