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 Inyeol.Lee, Jim Fasarakis-Hilliard, belopolsky, benjamin.peterson, danielsh, emptysquare, erickt, esc24, georg.brandl, glyph, gvanrossum, levkivskyi, ncoghlan, rhettinger, serhiy.storchaka, yselivanov
Date 2017-11-25.03:57:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Given the direction of the python-dev thread, should we split this question into two issues?

Issue 1: a yield expression inside a comprehension changes the type of the expression result (returning a generator-iterator instead of the expected container type)

Issue 2: a yield expression inside a generator expression interacts weirdly with the genexp's implicit yield expression

I ask, as it seems to me that issue 1 can be addressed by wrapping the affected cases in an implicit 'yield from' expression, which will both fix the return type of the expression and turn the outer function into a generator (if it isn't one already). (I'm going to put together a proof-of-concept for that idea this weekend)

By contrast, the interaction between generator expressions and explicit yield expressions seems intrinsically confusing, so I'm not sure we can do any better than declaring it a syntax error to try to combine them.
Date User Action Args
2017-11-25 03:57:18ncoghlansetrecipients: + ncoghlan, gvanrossum, georg.brandl, rhettinger, belopolsky, benjamin.peterson, erickt, glyph, Inyeol.Lee, serhiy.storchaka, yselivanov, esc24, danielsh, emptysquare, levkivskyi, Jim Fasarakis-Hilliard
2017-11-25 03:57:17ncoghlansetmessageid: <>
2017-11-25 03:57:17ncoghlanlinkissue10544 messages
2017-11-25 03:57:17ncoghlancreate