PyCQA/flake8-bugbear

Proposed rule: match zip() arguments and unpacked variables

Open

#545 建立於 2026年2月25日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)Python (116 fork)github user discovery
enhancementhelp wanted

倉庫指標

Star
 (1,116 star)
PR 合併指標
 (PR 指標待抓取)

描述

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…)

貢獻者指南