Batteries included iteration tools

So far we've covered the many ways Python offers for creating iterable objects. Comprehensions, generators, and any object that follows the iterable or iterator protocols can be used for iteration, so it should be clear that iteration is a central feature of Python.

Python provides a number of built-in functions for performing common iterator operations. These functions form the core of a sort of vocabulary for working with iterators, and they can be combined to produce powerful statements in very concise, readable code. We've met some of these functions already, including enumerate() for producing integer indices and sum() for computing summation of numbers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset