Iterator isn't reentrant
suggest changedef gen():
yield 1
iterable = gen()
for a in iterable:
print a
# What was the first item of iterable? No way to get it now.
# Only to get a new iterator
gen()
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents