Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MaxWinterstein opened this issue Mar 21, 2023 · 2 comments · Fixed by #3654
Closed

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

MaxWinterstein opened this issue Mar 21, 2023 · 2 comments · Fixed by #3654
Assignees
Labels
bug Something isn't working

Comments

@MaxWinterstein
Copy link

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
@MaxWinterstein MaxWinterstein changed the title RUF007 - False positive when zip contains more than 2 arguments RUF007 - False positive when zip() contains more than 2 arguments Mar 21, 2023
@charliermarsh
Copy link
Member

Thanks!

@MaxWinterstein MaxWinterstein changed the title RUF007 - False positive when zip() contains more than 2 arguments RUF007 - False positive when zip() contains more than 2 arguments Mar 21, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Mar 21, 2023
@JonathanPlasse
Copy link
Contributor

I would like to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants