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 <1511582237.93.0.213398074469.issue10544@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
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: <1511582237.93.0.213398074469.issue10544@psf.upfronthosting.co.za>
2017-11-25 03:57:17ncoghlanlinkissue10544 messages
2017-11-25 03:57:17ncoghlancreate