Summary

  • Comprehensions are a concise syntax for describing lists, sets and dictionaries.

  • Comprehensions operate on a iterable source object and apply an optional predicate filter and a mandatory expression, both of which are usually in terms of the current item.

  • The iterables objects are objects over which we can iterate item-by-item.

  • We retrieve an iterator from an iterable object using the built-in iter() function.

  • Iterators produce items one-by-one from the underlying iterable series each time they are passed to the built-in next() function.

  • Iterators raise a StopIteration exception when the collection is exhausted.

     

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

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