[Python-ideas] PEP 572 version 2: Statement-Local Name Bindings

Christoph Groth christoph at grothesque.org
Sat Mar 24 05:07:38 EDT 2018


Chris Angelico wrote:

> Thank you; both of these have now been incorporated into the document.

Thanks!  Just a small comment.  You wrote in the PEP draft:

> # Name bindings inside list comprehensions usually won't leak
> ...
> # But occasionally they will!

I don't understand what you mean here.  If the (y as x) syntax is to
have, as you say, "the exact same semantics as regular assignment", then
assignments inside list comprehensions would always "leak".  But this is
a good thing, because this is consistent with how Python behaves.

Christoph


More information about the Python-ideas mailing list