-
Notifications
You must be signed in to change notification settings - Fork 848
Prefer unpacking over concatenating (RUF005) #2230
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
base: main
Are you sure you want to change the base?
Conversation
mhammond
left a comment
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.
I'm fairly ambivalent about this one - I think ever Python programmer understands list concatenation. What's the motivation here?
This also opens the door to using more tuples and generators in these places for further optimizations Used Ruff to prevent regressions
8f1f4ec to
a64dc22
Compare
The idea is to get more performant code, essentially "for free" (as in you don't have to think much about it, since it's autofixed). This would be even better if astral-sh/ruff#10592 gets implemented. In the mean time I've fixed nested unpacking manually (searching for regex |
6e4f3bc to
d5795b5
Compare
…king-over-concatenating
…king-over-concatenating
|
|
This also opens the door to using more tuples and generators in these places for further optimizations
Used Ruff to find these and prevent regressions
https://docs.astral.sh/ruff/rules/collection-literal-concatenation/
Closes #775