adamchainz / flake8-comprehensions

❄️ A flake8 plugin to help you write better list/set/dict comprehensions.
MIT License
465 stars 23 forks source link

Add rule to check for unnecessary generator expressions #581

Open tjkuson opened 4 months ago

tjkuson commented 4 months ago

Adds C421 that checks for unnecessary generator expressions that simply yield items from an iterable.

This patch contains a recursive function to determine if two tuple match whilst handling nesting (for example, (a, ((b, c) d))). I can change it to not check nested tuples if you would rather not have that complexity.

Closes #503