Chapter 19. Iterators and Generators


    Introduction

    Recipe 19.1.  Writing a range-like Function with Float Increments

    Recipe 19.2.  Building a List from Any Iterable

    Recipe 19.3.  Generating the Fibonacci Sequence

    Recipe 19.4.  Unpacking a Few Items in a Multiple Assignment

    Recipe 19.5.  Automatically Unpacking the Needed Number of Items

    Recipe 19.6.  Dividing an Iterable into n Slices of Stride n

    Recipe 19.7.  Looping on a Sequence by Overlapping Windows

    Recipe 19.8.  Looping Through Multiple Iterables in Parallel

    Recipe 19.9.  Looping Through the Cross-Product of Multiple Iterables

    Recipe 19.10.  Reading a Text File by Paragraphs

    Recipe 19.11.  Reading Lines with Continuation Characters

    Recipe 19.12.  Iterating on a Stream of Data Blocks as a Stream of Lines

    Recipe 19.13.  Fetching Large Record Sets from a Database with a Generator

    Recipe 19.14.  Merging Sorted Sequences

    Recipe 19.15.  Generating Permutations, Combinations, and Selections

    Recipe 19.16.  Generating the Partitions of an Integer

    Recipe 19.17.  Duplicating an Iterator

    Recipe 19.18.  Looking Ahead into an Iterator

    Recipe 19.19.  Simplifying Queue-Consumer Threads

    Recipe 19.20.  Running an Iterator in Another Thread

    Recipe 19.21.  Computing a Summary Report with itertools.groupby



Python Cookbook
Python Cookbook
ISBN: 0596007973
EAN: 2147483647
Year: 2004
Pages: 420

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net