Message372390
Brandt found this out while testing his implementation of the `match` statement. When a list or tuple are followed by a colon without an annotation, the old parser used to say "invalid syntax", while the new parser considers this an annotation and outputs something along the lines of "only single target (not tuple) can be annotated". For example:
➜ cpython git:(master) ./python.exe
Python 3.10.0a0 (heads/master:06a40d7359, Jun 26 2020, 01:33:34)
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> (a, b):
File "<stdin>", line 1
(a, b):
^
SyntaxError: only single target (not tuple) can be annotated
>>> [a, b]:
File "<stdin>", line 1
[a, b]:
^
SyntaxError: only single target (not list) can be annotated
>>> a,:
File "<stdin>", line 1
a,:
^
SyntaxError: only single target (not tuple) can be annotated
The behavior of the old parser seems more logical. |
|
Date |
User |
Action |
Args |
2020-06-25 22:36:38 | lys.nikolaou | set | recipients:
+ lys.nikolaou, gvanrossum, pablogsal, brandtbucher |
2020-06-25 22:36:38 | lys.nikolaou | set | messageid: <1593124598.52.0.640760442401.issue41119@roundup.psfhosted.org> |
2020-06-25 22:36:38 | lys.nikolaou | link | issue41119 messages |
2020-06-25 22:36:38 | lys.nikolaou | create | |
|