[issue5577] yield in iterators

Antoine Pitrou report at bugs.python.org
Fri Mar 27 16:53:34 CET 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

It's true, however, that there is a difference in behaviour between 2.x
and 3.x here.
In 2.x, the function containing the list comprehension is a generator.
In 3.x, it's the list comprehension itself which becomes a generator.
I'm not sure which one is more useful. Also, it's likely that this won't
be changed, because it's due to the compilation model of list
comprehensions (which are compiled as a separate code object in 3.x).

----------

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


More information about the Python-bugs-list mailing list