[Python-ideas] Modern language design survey for "assign and compare" statements
paul-python at svensson.org
Sat May 19 01:49:55 EDT 2018
On Sat, 19 May 2018, Greg Ewing wrote:
> Chris Angelico wrote:
>> The 'as' syntax has been hammered out in great detail and is no longer
>> recommended due to its negative interactions with existing constructs.
> Allowing it in arbitrary expressions has been ruled out on
> the grounds that the difference between "with x as y:" and
> "with (x as y):" would be too subtle.
I don't quite get what's so subtle about it, am I missing something?
The "with" keyword calls "__enter__", and "as" gives it a name.
Just like "-x + y" is different from "-(x + y)",
each part does it's thing, and you control the order with parens.
More information about the Python-ideas