[Python-ideas] Modern language design survey for "assign and compare" statements
greg.ewing at canterbury.ac.nz
Sat May 19 02:12:34 EDT 2018
Paul Svensson wrote:
> 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)",
I think the difference is that mentally one already tends to
think of "with x as y" being grouped "with (x as y)" rather
than "(with x) as y". So, if "x as y" becomes a legal expression
all by itself, it will *seem* as though the meaning of "as" is
changed simply by adding explicit parentheses around an
expression that was already implicitly parenthesised.
Whether this is too subtle or not is a matter of opinion, but
it was raised as one of the objections to using "as", so some
people obviously thought so.
More information about the Python-ideas