Skip to content

RUF007 - False positive when zip() contains more than 2 arguments #3651

@MaxWinterstein

Description

@MaxWinterstein

RUF007 should only hit when zip() is called with no more than 2 arguments, as pairwise() does not support it.

Introduced with #3501

See

pyproject.toml

[tool.ruff]
target-version = "py311"

test.py

foo = [1, 2, 3, 4]

bar = zip(foo[:-1], foo[1:], foo, strict=True)

ruff test.py

test.py:5:7: RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
Found 1 error.

ruff --version

ruff 0.0.257

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions