-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Warn against quadratic list summation #5073
Comments
Is the correct replacement for this |
Yup, that'll work! I don't have strong opinions on the replacement, they all seem to be a constant factor off.
Repro using the nice perfplot code from your StackOverflow link: |
Saw a "needs decision" label got added. I'd vote the best replacement is |
I'm cool with adding this as long as the ecosystem checks look okay (that is: no major false positives). |
You can assign this to me. I should have a fix out soon. |
As discussed in #6489 (comment). Linking #5073
funny enough, if I use But when I reimplement the same code in a very naive way:
it is on par with proposed solutions (or even faster) |
Yes, that's the magic of |
I can't find a linter that warns me about
sum(list_of_lists, [])
. Basically any time thedefault
arg ofsum
is a list literal, I think something slow could happen. Maybe ruff could warn me about this? :-)The text was updated successfully, but these errors were encountered: