Chapter 19. Iterators and Generators
- IntroductionRecipe 19.1.
Writing a range-like Function with Float IncrementsRecipe 19.2.
Building a List from Any IterableRecipe 19.3.
Generating the Fibonacci SequenceRecipe 19.4.
Unpacking a Few Items in a Multiple AssignmentRecipe 19.5.
Automatically Unpacking the Needed Number of ItemsRecipe 19.6.
Dividing an Iterable into n Slices of Stride nRecipe 19.7.
Looping on a Sequence by Overlapping WindowsRecipe 19.8.
Looping Through Multiple Iterables in ParallelRecipe 19.9.
Looping Through the Cross-Product of Multiple IterablesRecipe 19.10.
Reading a Text File by ParagraphsRecipe 19.11.
Reading Lines with Continuation CharactersRecipe 19.12.
Iterating on a Stream of Data Blocks as a Stream of LinesRecipe 19.13.
Fetching Large Record Sets from a Database with a GeneratorRecipe 19.14.
Merging Sorted SequencesRecipe 19.15.
Generating Permutations, Combinations, and SelectionsRecipe 19.16.
Generating the Partitions of an IntegerRecipe 19.17.
Duplicating an IteratorRecipe 19.18.
Looking Ahead into an IteratorRecipe 19.19.
Simplifying Queue-Consumer ThreadsRecipe 19.20.
Running an Iterator in Another ThreadRecipe 19.21.
Computing a Summary Report with itertools.groupby