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.

--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to