In 15 for in range In 16 for in enumerate if break In 17 Out 17 genera

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
In [15]: g = (x for x in range(5))
In [16]: for i, y in enumerate(g):
....: if i == 3: break
....:
In [17]: g
Out[17]: <generator object <genexpr> at 0x84253ec>
In [18]: list(g)
Out[18]: [4]