PyCQA/flake8-bugbear

Proposed rule: match zip() arguments and unpacked variables

Open

#545 geöffnet am 25. Feb. 2026

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (116 Forks)github user discovery
enhancementhelp wanted

Repository-Metriken

Stars
 (1.116 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

In an older code blob of mine I came across this oddity:

for a, b, _ in zip(iter_a, iter_b, iter_c):
    ...

which should be simplified to

for a, b in zip(iter_a, iter_b):
    ...

by removing iter_c entirely. Turns out I had this pattern in two other places as well 🤦🏻‍♂️

Would this not be a useful idiom to look for and warn about? (Assuming _ isn’t used in the body of the loop…)

Contributor Guide