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.

classification
Title: SyntaxError describing the error using a wrong term
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Takuo Matsuoka, pablogsal
Priority: normal Keywords:

Created on 2021-08-26 13:40 by Takuo Matsuoka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg400344 - (view) Author: Takuo Matsuoka (Takuo Matsuoka) Date: 2021-08-26 13:40
The error is this:

>>> *()
  File "<stdin>", line 1
SyntaxError: can't use starred expression here


I think it's right SyntaxError is raised here, but the message is
incorrect. Indeed, many starred expressions are actually allowed
there. E.g.,

>>> *(),
()


I happen to have filed in this issue tracker the problem that the
definition of a starred expression given in the Language Reference is
incorrect.

https://bugs.python.org/issue44983

It appears all correct starred expressions and only them are allowed
at the point of the error. Thus the error appears to
be one because "*()" is not a starred expression in the correct
sense. I think the wording in the message should be corrected.
msg400406 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-08-27 10:07
The error is correct:

>>> *(2,3,4)
  File "<stdin>", line 1
SyntaxError: can't use starred expression her

The problem is that you are trying to use as top level while:

*(),

is equivalent to:

(*(),)

which is using them in a tuple
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89177
2021-08-27 10:07:24pablogsalsetstatus: open -> closed

nosy: + pablogsal
messages: + msg400406

resolution: not a bug
stage: resolved
2021-08-26 13:40:24Takuo Matsuokacreate