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

Unnecessary list comprehension that can be a call to list() #163

Closed
adamchainz opened this issue Jul 6, 2019 · 1 comment · Fixed by #190
Closed

Unnecessary list comprehension that can be a call to list() #163

adamchainz opened this issue Jul 6, 2019 · 1 comment · Fixed by #190

Comments

@adamchainz
Copy link
Owner

As per https://treyhunner.com/2019/03/abusing-and-overusing-list-comprehensions-in-python/

if we have

[x for x in foobar]

it can always be replaced with

list(foobar)
adamchainz pushed a commit that referenced this issue Nov 15, 2019
* Added C413 check for unnecessary calls around sorted().

Fixes #60.

* Added C414 check for unnecessary calls within list/set/sorted/tuple().

* Added C415 check for unnecessary subscript reversal of iterable within reversed/set/sorted().

* Added C416 check for unnecessary list/set comprehension - rewrite using list/set().

Fixes #163.
@adamchainz
Copy link
Owner Author

Released in 3.1.0: https://pypi.org/project/flake8-comprehensions/3.1.0/

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.

1 participant