[Python-ideas] A comprehension scope issue in PEP 572
Jacco van Dorp
j.van.dorp at deonet.nl
Tue May 8 03:17:13 EDT 2018
> (inside a synthetic function created to
> implement a listcomp/genexp, names bound by "=" are local; names bound
> by ":=" are nonlocal; names bound by both are "who cares?"-
> compiler-time error would be fine by me, or the first person to show a
> real use case wins).
Wait, you can't use = in a listcomp, right ? Or are you talking about
the implementation hidden to the casual user ?
I thought letting := bind to the surrounding scope was fine basically
because it's currently not possible, so therefore there would be no
syntactic ambiguity, and it'd actually do what people would expect.
More information about the Python-ideas