Skip to content

Unnecessary list comprehension in sum, min, max #3259

@janosh

Description

@janosh

It's not part of PIE802 so maybe this should go somewhere else but I noticed #3149 doesn't include built-in aggregators like sum(), min(), max().

Suggestion is to auto-fix:

# error
sum([i**2 for i in range(10)])

# ok
sum(i**2 for i in range(10))

Maybe this is covered by flake8-comprehensions? Looked but couldn't find it.

Metadata

Metadata

Assignees

Labels

ruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions