Definition of a starred expression in the Language Reference
Dear developers, According to the Language Reference, a starred expression is defined by starred_expression ::= expression | (starred_item ",")* [starred_item] https://docs.python.org/3/reference/expressions.html#expression-lists However, in view of the definition of an assignment statement assignment_stmt ::= (target_list "=")+ (starred_expression | yield_expression) https://docs.python.org/3/reference/simple_stmts.html#assignment-statements I believe the correct definition actually used is starred_expression ::= expression | (starred_item ",")+ [starred_item] (that is, use "+" instead of "*"). Should it be fixed? Best regards, Takuo Matsuoka
On 2021-08-22 11:51, Matsuoka Takuo wrote:
Dear developers,
According to the Language Reference, a starred expression is defined by
starred_expression ::= expression | (starred_item ",")* [starred_item]
https://docs.python.org/3/reference/expressions.html#expression-lists
However, in view of the definition of an assignment statement
assignment_stmt ::= (target_list "=")+ (starred_expression | yield_expression)
https://docs.python.org/3/reference/simple_stmts.html#assignment-statements
I believe the correct definition actually used is
starred_expression ::= expression | (starred_item ",")+ [starred_item]
(that is, use "+" instead of "*").
Should it be fixed?
The existing definition states that 'starred_expression' could be empty, so it does look suspicious.
I have filed this at the issue tracker at https://bugs.python.org/issue44983 Best regards, Takuo
participants (2)
-
Matsuoka Takuo
-
MRAB