[Python-ideas] Spelling of Assignment Expressions PEP 572 (was post #4)

Kirill Balunov kirillbalunov at gmail.com
Fri Apr 13 17:33:49 EDT 2018


2018-04-13 23:31 GMT+03:00 Chris Angelico <rosuav at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180414/a4e76609/attachment-0001.html>


More information about the Python-ideas mailing list