[issue10544] yield expression inside generator expression does nothing

Guido van Rossum report at bugs.python.org
Mon Nov 29 04:13:56 CET 2010


Guido van Rossum <guido at python.org> added the comment:

I think it is definitely wrong the way it works in 3.x.  (Especially since it works as expected in 2.x.)

I agree with Inyeol's preference of fixes: (1) make it work properly for listcomps as well as genexps, (2) if that's not possible, forbid yield in a genexp or listcomp.

Note that even though yield in a genexp could be considered as having a well-defined meaning, that meaning is not useful and I would consider it as merely a coincidence of the specification, not an intentional effect.  So I would be fine changing its meaning.  (My assumption is that since it is not useful there is -- almost -- no code depending on that meaning.)

----------

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


More information about the Python-bugs-list mailing list