On Mon, May 14, 2018 at 7:00 AM, Cameron Simpson <c...@cskk.id.au> wrote: > While I can see the issue, on a personal basis I'd accept it: import and > except don't do this and they happily use "as". In my mind the problem lies > with "with" (and is a perfectly acceptable inconsistency there, given what > with does for us).
The same problem happens with 'except', only less subtly. except Exception as e: # binds the caught exception to e except (Exception as e): # would bind the type Exception import doesn't put an expression on the left of 'as', so it's less likely to cause confusion; but all three of them do something special before binding to the target given with 'as'. By the way: do you know which of the three support arbitrary assignment targets and which support only names? No? Neither did I, till I checked the grammar. So there's no consistency there, other than a loose sense that "as" means "we're gonna toss something into somewhere". Not nearly enough to justify using that syntax for arbitrary name bindings, given how much hassle there is with 'with'. 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/