[Python-ideas] PEP 572 version 2: Statement-Local Name Bindings
Ethan Furman
ethan at stoneleaf.us
Fri Mar 2 13:27:05 EST 2018
On 03/02/2018 03:43 AM, Chris Angelico wrote:
> PEP: 572
> Title: Syntax for Statement-Local Name Bindings
> Author: Chris Angelico <rosuav at gmail.com>
Looks nice, thanks for the updates!
> Alternative proposals
> =====================
> 6. Allowing ``(EXPR as NAME)`` to assign to any form of name.
>
> This is exactly the same as the promoted proposal, save that the name is
> bound in the same scope that it would otherwise have. Any expression can
> assign to any name, just as it would if the ``=`` operator had been used.
Just to clarify: "bound in the same scope" means exactly that -- if the (EXPR as NAME) is in a comprehension, then it
is local /to that comprehension/ (emphasis because I didn't adequately convey that it my initial response to Nick).
Still -1 to the PEP as written. (It would be positive for alternative 6. ;)
--
~Ethan~
More information about the Python-ideas
mailing list