This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients ezio.melotti, gcewing, hakril, ncoghlan
Date 2014-07-13.01:19:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405214353.36.0.905439565168.issue21964@psf.upfronthosting.co.za>
In-reply-to
Content
It's a side effect of the hidden closure that provides the new scope for the iteration variable - that's an ordinary function object, so using yield or yield from turns it into a generator expression instead. Generator expressions are already generators, so using yield or yield from just adds more yield points beyond the implied ones.

I've never figured out a good way to document it - it's a natural consequence of the comprehension's closure. An explicit mention in the reference docs for comprehensions may be worth adding.
History
Date User Action Args
2014-07-13 01:19:13ncoghlansetrecipients: + ncoghlan, gcewing, ezio.melotti, hakril
2014-07-13 01:19:13ncoghlansetmessageid: <1405214353.36.0.905439565168.issue21964@psf.upfronthosting.co.za>
2014-07-13 01:19:13ncoghlanlinkissue21964 messages
2014-07-13 01:19:12ncoghlancreate