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

Feature Request: Detect dictionary comprehensions with constant values #552

Open
tjkuson opened this issue Jan 21, 2024 · 2 comments · May be fixed by #553
Open

Feature Request: Detect dictionary comprehensions with constant values #552

tjkuson opened this issue Jan 21, 2024 · 2 comments · May be fixed by #553

Comments

@tjkuson
Copy link

tjkuson commented Jan 21, 2024

Description

Hi! Thanks for this helpful tool.

I'm working with code that has a lot of

{elt: None for elt in foo}

which is slower and (IMO) harder to read than

dict.fromkeys(foo)

Would there be interest in a rule that checks for dictionary comprehensions with constant values?

This has rule has been accepted by another project and it was suggested to me that I create an issue here too.

@adamchainz
Copy link
Owner

Yeah, I would like that here too. I don’t have time to work on it right now, but I’d accept a PR adding it.

@tjkuson
Copy link
Author

tjkuson commented Jan 22, 2024

I'll open a PR later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants