This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Carl.Friedrich.Bolz
Recipients Carl.Friedrich.Bolz
Date 2021-11-04.17:45:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636047949.0.0.244366488793.issue45716@roundup.psfhosted.org>
In-reply-to
Content
A bit of a nitpick, but the following SyntaxError message is a bit confusing:

>>> f(True=1)
  File "<stdin>", line 1
    f(True=1)
      ^^^^^
SyntaxError: expression cannot contain assignment, perhaps you meant "=="?

The problem with that line is not that it contains an assignment, it's almost a valid keyword argument after all. The problem is that the name of the keyword is True, which is no longer a name you can assign to. It would be better to produce the same error as with __debug__:

>>> f(__debug__=1)
  File "<stdin>", line 1
SyntaxError: cannot assign to __debug__

The latter error message is however produced by the compiler, not the parser I think?
History
Date User Action Args
2021-11-04 17:45:49Carl.Friedrich.Bolzsetrecipients: + Carl.Friedrich.Bolz
2021-11-04 17:45:48Carl.Friedrich.Bolzsetmessageid: <1636047949.0.0.244366488793.issue45716@roundup.psfhosted.org>
2021-11-04 17:45:48Carl.Friedrich.Bolzlinkissue45716 messages
2021-11-04 17:45:48Carl.Friedrich.Bolzcreate