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 benjamin.peterson, brett.cannon, ncoghlan, scoder, serhiy.storchaka, steven.daprano, yselivanov
Date 2019-10-15.21:39:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1571175569.19.0.128105734525.issue32856@roundup.psfhosted.org>
In-reply-to
Content
I just discovered that the assignment operator leaks variables out of comprehensions.

>>> [(j:=i*i)+1/j for i in range(1, 3)]
[2.0, 4.25]
>>> j
4
>>> g = ((j:=i*i*i)+1/j for i in range(1, 3))
>>> list(g)
[2.0, 8.125]
>>> j
8

So it does not supersedes this optimization.
History
Date User Action Args
2019-10-15 21:39:29serhiy.storchakasetrecipients: + serhiy.storchaka, brett.cannon, ncoghlan, scoder, benjamin.peterson, steven.daprano, yselivanov
2019-10-15 21:39:29serhiy.storchakasetmessageid: <1571175569.19.0.128105734525.issue32856@roundup.psfhosted.org>
2019-10-15 21:39:29serhiy.storchakalinkissue32856 messages
2019-10-15 21:39:29serhiy.storchakacreate