Skip to content
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

Use list comprehension to join strings #41753

Closed
MarcoGorelli opened this issue Jun 1, 2021 · 2 comments
Closed

Use list comprehension to join strings #41753

MarcoGorelli opened this issue Jun 1, 2021 · 2 comments
Labels
Code Style Code style, linting, code_checks Performance Memory or execution speed performance

Comments

@MarcoGorelli
Copy link
Member

In #41160 , a new pyupgrade feature did some rewrites likes

-    s = "\n".join([_build_option_description(k) for k in keys])
+   s = "\n".join(_build_option_description(k) for k in keys)

However, they then reverted this feature as it was a potential performance regression (asottile/pyupgrade#456).

I think we should revert those changes (though arguably not the entire PR) and add a rule to pandas-dev-flaker about using list comprehensions rather than generators when joining strings

If nobody takes this on earlier, I'll do this on Friday

@MarcoGorelli MarcoGorelli added Performance Memory or execution speed performance Code Style Code style, linting, code_checks labels Jun 1, 2021
@ghost
Copy link

ghost commented Jun 21, 2021

take

@github-actions github-actions bot assigned ghost Jun 21, 2021
@jreback jreback added this to the 1.3 milestone Jun 22, 2021
@simonjayhawkins simonjayhawkins removed this from the 1.3 milestone Jun 25, 2021
MarcoGorelli pushed a commit that referenced this issue Jul 11, 2021
* PERF: Use list comprehension to join strings (#41753)

* Fix pre-commit failures
@MarcoGorelli
Copy link
Member Author

the PR for this was made to pandas-dev-flaker so we can close here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks Performance Memory or execution speed performance
Projects
None yet
Development

No branches or pull requests

3 participants