Like list comprehensions bu create a generator object
More Efficient than Iterables
Use Parentheses rather than brackets
A generator expression is similar to a list comprehension, but it provides a generator instead of a list.
Generator Expressions use ()
Generator Expressions are especially useful with functions like sum(), min() and max() that reduce an utterable imputes to a single value:
The entire list will be stored in memory
>>> s1 = sum([x * x for x in range(10)])
>>> s1
285
>>> s2 = sum(x * x for x in range(10))
>>> s2
285
This will read in each line into memory one at a time.
>>> page = open("mary.txt")
>>> m = max(len(line) for line in page)
>>> m
37