2018-04-13 23:31 GMT+03:00 Chris Angelico <ros...@gmail.com>: > > > # but these are subtly different and will be a trap for the unwary > > with expression as name: # name is set to __enter__() > > with (expression as name): # name is not set to __enter__() > > And that's a good reason to reject the last one with a SyntaxError, > but that creates an odd discrepancy where something that makes perfect > logical sense is rejected. > > Maybe it does not suit you, but what do you think about `SyntaxWarning` instead of `SyntaxError` for both `with` and `except`. By analogy how it was done for `global name` into function body prior to Python 3.6?
With kind regards, -gdg
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/