-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Rule suggestion: recommend dict.fromkeys
over comprehension
#9592
Comments
Looks great! |
I could pick up this one? |
Haven't started anything, have at it! @mikeleppane |
This would be a great rule for refurb, C4, or perflint. You should consider pinging the author of those libraries as well. |
This applies not only to |
@tjkuson @charliermarsh would you agree? ↑ |
Yes, this was my intention with the issue. Admittedly, I communicated that poorly by using only examples with |
Closed by #9613. Thanks @mikeleppane! |
Replace
with
dict.fromkeys
is more efficient and readable.Efficiency boost tested on both Python 3.9 and 3.12.
Note: would have to skip this rule for mutable values (see #4613).
The text was updated successfully, but these errors were encountered: