Message405741
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? |
|
Date |
User |
Action |
Args |
2021-11-04 17:45:49 | Carl.Friedrich.Bolz | set | recipients:
+ Carl.Friedrich.Bolz |
2021-11-04 17:45:48 | Carl.Friedrich.Bolz | set | messageid: <1636047949.0.0.244366488793.issue45716@roundup.psfhosted.org> |
2021-11-04 17:45:48 | Carl.Friedrich.Bolz | link | issue45716 messages |
2021-11-04 17:45:48 | Carl.Friedrich.Bolz | create | |
|