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 serhiy.storchaka
Recipients Inyeol.Lee, Jim Fasarakis-Hilliard, arigo, belopolsky, benjamin.peterson, danielsh, emptysquare, erickt, esc24, georg.brandl, glyph, gvanrossum, levkivskyi, ncoghlan, rhettinger, serhiy.storchaka, yselivanov
Date 2017-11-23.12:00:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Consider this as a sort of optimization. A function inlining. In general case we can't inline a function because it can be rebinded at any time, but in this particular case we call a just created function that doesn't have any references and live only on the stack a, and we have all information for generating an inlined code. This will allow to get rid of the overhead for creating and calling a one-time function.

The naming problem is the hardest problem. We should assign unique names for internal variables, like '.0.x'. We already do this for the single parameter of a one-time function. Or we could just use a stack (this requires more work but has additional benefits).

If you want to think about comprehensions as about calling inner functions, you can do this. And you can think about comprehensions as about loops which don't leak inner variables. The behavior should be absolutely identical until you will use "yield" which would turn your list producing function into a generator. If make "yield" turning into a generator not an implicit inner function, but an explicit enclosing function, a comprehension could be represented via an implicit inner function. Currently there is no way to express this in Python syntax, but before introducing "yield" there was no way to express its semantic.
Date User Action Args
2017-11-23 12:00:03serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, arigo, georg.brandl, rhettinger, ncoghlan, belopolsky, benjamin.peterson, erickt, glyph, Inyeol.Lee, yselivanov, esc24, danielsh, emptysquare, levkivskyi, Jim Fasarakis-Hilliard
2017-11-23 12:00:03serhiy.storchakasetmessageid: <>
2017-11-23 12:00:03serhiy.storchakalinkissue10544 messages
2017-11-23 12:00:03serhiy.storchakacreate