John added the comment:
Consider the following generator function similar to the one that started this
issue:
from __future__ import generator_stop
def myzip(*seqs):
its = (iter(seq) for seq in seqs)
while True:
try:
yield tuple(next(it) for it in its)
except RuntimeError:
return
g = myzip('abc', 'xyz')
print([next(g) for i in range(5)]) # prints: [('a', 'x'), (), (), (), ()]
A print(list(g)) would cause a hang.
----------
nosy: +john.black.3k
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22906>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com