(Performance) Prefer unpacking over concatenating (RUF005) and remove unecessary spread (PIE800)#2230
Open
Avasam wants to merge 11 commits intomhammond:mainfrom
Open
(Performance) Prefer unpacking over concatenating (RUF005) and remove unecessary spread (PIE800)#2230Avasam wants to merge 11 commits intomhammond:mainfrom
Avasam wants to merge 11 commits intomhammond:mainfrom
Conversation
mhammond
reviewed
Apr 10, 2024
Owner
mhammond
left a comment
There was a problem hiding this comment.
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
Collaborator
Author
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 comment was marked as resolved.
This comment was marked as resolved.
…king-over-concatenating
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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