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 levkivskyi
Recipients Inyeol.Lee, arigo, belopolsky, benjamin.peterson, danielsh, emptysquare, erickt, esc24, georg.brandl, glyph, gvanrossum, levkivskyi, rhettinger
Date 2017-01-28.11:28:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> How about fixing CPython to raise SyntaxWarning or even SyntaxError?

I think it is better to just fix the issue, i.e. make comprehensions be equivalent to for-loops even if they contain `yield`. (In particular this will lead to [(yield i) for i in range(5)] be SyntaxError outside function).

The example of `await` shows that it is possible without leaking the loop variable into enclosing scope.
Date User Action Args
2017-01-28 11:28:57levkivskyisetrecipients: + levkivskyi, gvanrossum, arigo, georg.brandl, rhettinger, belopolsky, benjamin.peterson, erickt, glyph, Inyeol.Lee, esc24, danielsh, emptysquare
2017-01-28 11:28:57levkivskyisetmessageid: <>
2017-01-28 11:28:57levkivskyilinkissue10544 messages
2017-01-28 11:28:56levkivskyicreate