-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
(🎁) Remove redundant parenthesis in getitem
/indexing operator
#3679
Comments
getitem
/indexing operatorgetitem
/indexing operator
We can't remove the comma; that would be a change in the AST and would break code.
We could remove the parentheses, though. |
AFAIK Python 3.10.6 …
>>> 1==(1)
True
>>> 1==(1,)
False
>>> (1)==(1,)
False
>>> type((1,))
<class 'tuple'>
>>> type((1))
<class 'int'>
>>> |
Okay, but how does that relate to this issue? |
Uniformity among equivalent expressions like the following would also be appreciated. (a, b) = (1, 2)
(a, b) = 1, 2
a, b = (1, 2)
a, b = 1, 2
return (1, 2)
return 1, 2 Uniformity would be appreciated even when the tuple length is 1. (a,) = (1,)
(a,) = 1,
a, = (1,)
a, = 1, Note: I would say that these expressions are for tuples and are not equivalent to a = 1 if that's what folks want. |
Given:
😢 Current behavior
No modifications
😲 Desired behavior
The text was updated successfully, but these errors were encountered: