On Sun, Apr 29, 2018 at 6:04 AM, Ed Kellett <e+python-id...@kellett.im> wrote: > On 2018-04-28 18:36, Chris Angelico wrote: >> This makes reasonable sense. The parentheses completely enclose the >> local scope. It's compiler magic, and you cannot explain it as a >> function call, but it makes intuitive sense. But the same thing inside >> the if header itself would be much weirder. I'm actually not even sure >> what it would do. And you've clearly shown that the local() call can >> be anywhere inside the condition, based on these examples: > > What if the names persist until the end of the statement? That covers if > (where the statement lasts until the end of the if...elif...else block) > and regular expressions, though it does introduce a potentially annoying > shadowing thing: > >>>> x = 2 >>>> (local(x=4, x + 1), x) > (5,4) >
Oh, you mean exactly like PEP 572 used to advocate for? :) Can't say I'd be against that, although I'm not enamoured of the function-like syntax. But if you remove the function-like syntax and change the semantics, it isn't exactly Tim's proposal any more. :) ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/