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 subscript operations #3680
base: main
Are you sure you want to change the base?
Conversation
950ef20
to
5901e52
Compare
diff-shades results comparing this PR (9e5a1e6) to main (27c05e1). The full diff is available in the logs under the "Generate HTML diff report" step.
|
CHANGES.md
Outdated
@@ -16,6 +16,7 @@ | |||
|
|||
- Implicitly concatenated strings used as function args are no longer wrapped inside | |||
parentheses (#3640) | |||
- Redundant parenthesis are removed from `__getitem__`/`__setitem__` calls (#3680) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Redundant parenthesis are removed from `__getitem__`/`__setitem__` calls (#3680) | |
- Redundant parentheses are removed from subscript operations (#3680) |
) | ||
or ( | ||
is_walrus_assignment(node.children[1]) | ||
# This is only supported in py310 and up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use black.mode.supports_feature
here.
x[(1, 2)] = 1 | ||
x[1, 2] = 1 | ||
x[(1, 2)] = 1 | ||
x[(1, 2),] = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some test cases that use del x[(1)]
and similar, just because it's different in the grammar
__getitem__
calls25d98d5
to
b56e84c
Compare
getitem
/indexing operator #3679Description
Okay, so basically I think this is a based feature because of the confusing nature of the implicit tupleification of getitem.
(Also it will help with KotlinIsland/basedmypy#418)
Checklist - did you ... know ❓
CHANGES.md
if necessary?I'm not familiar with this codebase sorry, all feedback is welcome!