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, arigo, belopolsky, benjamin.peterson, danielsh, emptysquare, erickt, esc24, georg.brandl, glyph, gvanrossum, levkivskyi, ncoghlan, rhettinger, serhiy.storchaka
Date 2017-11-23.11:28:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1511436538.03.0.213398074469.issue10544@psf.upfronthosting.co.za>
In-reply-to
Content
Another slight variant to that test case to make sure the inner comprehension actually generates a closure reference in the current implementation:

    >>> [[x+y for x in range(2) for y in range(1, i)] for i in range(2, 5)]
    [[1, 2], [1, 2, 2, 3], [1, 2, 3, 2, 3, 4]]

These are the kind of challenges that drove of us towards the current implementation. While the status quo definitely has its downsides, those downsides at least all flow directly from "There's an implicit nested function there that you're not expecting".

Yury took all this into account when designing the interaction between `await` and comprehensions (which is why that's in a better state), but for `yield` we inherited the existing behaviour of any other nested function.
History
Date User Action Args
2017-11-23 11:28:58ncoghlansetrecipients: + ncoghlan, gvanrossum, arigo, georg.brandl, rhettinger, belopolsky, benjamin.peterson, erickt, glyph, Inyeol.Lee, serhiy.storchaka, esc24, danielsh, emptysquare, levkivskyi, Jim Fasarakis-Hilliard
2017-11-23 11:28:58ncoghlansetmessageid: <1511436538.03.0.213398074469.issue10544@psf.upfronthosting.co.za>
2017-11-23 11:28:58ncoghlanlinkissue10544 messages
2017-11-23 11:28:57ncoghlancreate