unpacked-list-comprehension (UP027)#
Derived from the pyupgrade linter.
Fix is always available.
What it does#
Checks for list comprehensions that are immediately unpacked.
Why is this bad?#
There is no reason to use a list comprehension if the result is immediately unpacked. Instead, use a generator expression, which is more efficient as it avoids allocating an intermediary list.
Example#
Use instead: