Message354753
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. |
|
Date |
User |
Action |
Args |
2019-10-15 21:39:29 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, brett.cannon, ncoghlan, scoder, benjamin.peterson, steven.daprano, yselivanov |
2019-10-15 21:39:29 | serhiy.storchaka | set | messageid: <1571175569.19.0.128105734525.issue32856@roundup.psfhosted.org> |
2019-10-15 21:39:29 | serhiy.storchaka | link | issue32856 messages |
2019-10-15 21:39:29 | serhiy.storchaka | create | |
|