◐ Shell
clean mode source ↗

Message 329596 - Python tracker

Actually, `(a) = 42` doesn't contradict the grammar.

assignment_stmt ::=  (target_list "=")+ (starred_expression | yield_expression)
target_list     ::=  target ("," target)* [","]
target          ::=  identifier
                     | "(" [target_list] ")"
                     | "[" [target_list] "]"
                     | attributeref
                     | subscription
                     | slicing
                     | "*" target

So that if we decide to disallow such things, we should change the definition in the language reference.

I thought the code should be similar to the code added in issue34641. But maybe there is a way to simplify both code.