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 lys.nikolaou
Recipients brandtbucher, gvanrossum, lys.nikolaou, pablogsal
Date 2020-06-25.22:36:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1593124598.52.0.640760442401.issue41119@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-06-25 22:36:38lys.nikolaousetrecipients: + lys.nikolaou, gvanrossum, pablogsal, brandtbucher
2020-06-25 22:36:38lys.nikolaousetmessageid: <1593124598.52.0.640760442401.issue41119@roundup.psfhosted.org>
2020-06-25 22:36:38lys.nikolaoulinkissue41119 messages
2020-06-25 22:36:38lys.nikolaoucreate