Generator Comprehensions
Learn when and how to use generator comprehensions.
We'll cover the following...
What is a generator comprehension?
A generator comprehension is similar to a list comprehension, which we learned about in an earlier chapter. The difference is that a generator comprehension uses lazy evaluation, which often uses less memory and allows infinite iterators to be processed.
Converting a list comprehension to a generator comprehension is a simple matter of replacing the ...