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

Alex Walters tritium-list at sdamon.com
Wed Feb 28 15:16:52 EST 2018


For what its worth, I'm +1 on it.

I actually like that it would allow:

while (something() as var):
    something_else(var)

...without being a bug magnet.  The bug magnet isn't the assignment of a
name in the condition of a while loop, it's the fact that assignment is a
simple typo away from comparison.  This is not a simple typo away from
comparison (the operands are a different order, too).

(sorry Chris, I didn't hit reply all the first time.)

> -----Original Message-----
> From: Python-ideas [mailto:python-ideas-bounces+tritium-
> list=sdamon.com at python.org] On Behalf Of Chris Angelico
> Sent: Wednesday, February 28, 2018 3:01 PM
> To: python-ideas <python-ideas at python.org>
> Subject: Re: [Python-ideas] PEP 572: Statement-Local Name Bindings
> 
> On Thu, Mar 1, 2018 at 6:54 AM, Brett Cannon <brett at python.org> wrote:
> > Thanks for taking the time to write this PEP, Chris, even though I'm -1
on
> > the idea. I'm glad to just have this as a historical document for the
idea.
> 
> I'm going to get a reputation for writing up PEPs for dead ideas. PEP
> 463 (exception-catching expressions) was the same. In this particular
> case, I'm fairly in favour of it, but only because I think it's cool -
> not because I have actual need for it - and if the PEP's rejected, so
> be it.
> 
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



More information about the Python-ideas mailing list