[issue5577] yield in iterators

qwjqwj report at bugs.python.org
Fri Mar 27 17:12:13 CET 2009


qwjqwj <qwj at papayamobile.com> added the comment:

Why should yield can be put inside the iterator? The behavior here is
very weired.

>>> x = [(yield i) for i in range(10)]
>>> print(list(x))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, [None, None, None, None, None, None,
None, None, None, None]]

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5577>
_______________________________________


More information about the Python-bugs-list mailing list