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

PLW3301: min/max false positive with iterables #4682

Closed
lovetox opened this issue May 27, 2023 · 2 comments · Fixed by #4683
Closed

PLW3301: min/max false positive with iterables #4682

lovetox opened this issue May 27, 2023 · 2 comments · Fixed by #4683
Labels
bug Something isn't working

Comments

@lovetox
Copy link

lovetox commented May 27, 2023

ruff: 0.0.267

tuples_list = [
    (1, 2),
    (2, 3),
    (3, 4),
    (4, 5),
    (5, 6),
]

max(max(tuples_list))

This raises PLW3301 [*] Nested max calls can be flattened

i don’t see how this can be flattend, if you only call max() once, it will return a tuple instead of the integer

@lovetox lovetox changed the title min/max false positive with iterables PLW3301: min/max false positive with iterables May 27, 2023
@charliermarsh charliermarsh added the bug Something isn't working label May 27, 2023
@charliermarsh
Copy link
Member

Thanks, you're right :)

@charliermarsh
Copy link
Member

Interestingly, Pylint flags this too.

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.

2 participants