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

Ethan Furman ethan at stoneleaf.us
Wed Feb 28 12:34:19 EST 2018


On 02/27/2018 02:27 PM, Chris Angelico wrote:

> PEP: 572

Because:

    a = (2 as a)

does not evaluate to 2

and because some statements, such as 'for' and 'while' can cover many, many lines (leaving plenty of potential for 
confusion over which variable disappear at the end and which persist):

-1

I would love to see an expression assignment syntax, but Statement-Local-Name-Binding is confusing and non-intuitive.

Is there already a PEP about expression assignment?  If not, that would be a good one to write.

--
~Ethan~


More information about the Python-ideas mailing list