-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unpacking without parentheses is allowed since 3.9 #90881
Comments
Seems that this is allowed since the PEG parser rewrite: for x in *a, *b:
print(x) but I cannot find anywhere were we discussed this. I am not sure if we should keep it or treat it as a bug and fix it. |
Since this was already allowed in 3.9 and 3.10 stable relases, and since it is consistent with the RHS of an assignment (something = *a, *b); I'd lean towards keeping it (and maybe fixing the old parser's grammar to reflect that) and documenting this. |
I'd lean towards keeping this syntax:
|
+1 (what Jelle said) |
Let's just document it for 3.11. |
Will prepare a PR |
Allowing no parentheses is also consistent with the following: |
Adding jwilk back (a bpo interaction with browser form caching makes this happen frequently). |
What exactly was happened? What rule was changed? Can it cause other changes which allow ambiguous code or change semantic? |
What happened is that the new grammar using the PEG parser used the equivalent of starred_testlist instead of testlist for the iterable list of for statements. The only extra thing allowed is starred elements, that are interpreted as if you are building a tuple without parentheses. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: