Derived from the flake8-comprehensions linter.
Fix is sometimes available.
What it does#
Checks for unnecessary list comprehensions passed to
Why is this bad?#
all take any iterators, including generators. Converting a generator to a list
by way of a list comprehension is unnecessary and reduces performance due to the
overhead of creating the list.
For example, compare the performance of
all with a list comprehension against that
of a generator (~40x faster here):