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

Revert "Apply ruff/flake8-comprehensions rule C420 (#13284)" #13294

Merged
merged 2 commits into from
Mar 23, 2025

Conversation

ichard26
Copy link
Member

I forgot about the fact we can ignore specific rules in advance.

I'm gonna leave this PR open for a few days for what I assume are obvious reasons. There's really no point in making our code less readable over this.

@ichard26 ichard26 added the skip news Does not need a NEWS file entry (eg: trivial changes) label Mar 20, 2025
@notatallshaw
Copy link
Member

notatallshaw commented Mar 21, 2025

FWIW, I find dict.fromkeys more readable, because I am familiar with the method, and it immediately tells me the value is a constant, whereas for a dictionary comprehension I have to parse the comprehension and determine whether the value is scoped within the comprehension or outside it.

But I do see for those not familiar with the method, dictionary comprehensions are far more common, this requires an extra look up as to what the method does.

And this is so minor, I am neither for or against it.

@uranusjr uranusjr merged commit 4b265b3 into pypa:main Mar 23, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants