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

PLR1704 issued for _ variable #12157

Closed
ktbarrett opened this issue Jul 2, 2024 · 4 comments · Fixed by #12190
Closed

PLR1704 issued for _ variable #12157

ktbarrett opened this issue Jul 2, 2024 · 4 comments · Fixed by #12190
Labels
bug Something isn't working good first issue Good for newcomers rule Implementing or modifying a lint rule

Comments

@ktbarrett
Copy link

I'm not sure what pylint does, but the variable _ is idiomatically used as a "don't care" variable (in fact unused variables that aren't _ trigger a different warning) and the error PLR1704 being issued for it I consider to be flying in the face of idiomatic code.

@ktbarrett
Copy link
Author

ktbarrett commented Jul 2, 2024

It seems the real issue is because I use _ for an unused argument, then use _ as a throwaway loop variable later. Perhaps this is just a bug.

def c(_):
    for _ in range(10):
        pass

@ktbarrett
Copy link
Author

I just checked, pylint does not issue a warning in this case.

@zanieb zanieb added the bug Something isn't working label Jul 2, 2024
@zanieb
Copy link
Member

zanieb commented Jul 2, 2024

Sounds like a bug to me. Thanks for the report.

xref #8159

@zanieb zanieb added good first issue Good for newcomers rule Implementing or modifying a lint rule labels Jul 2, 2024
@charliermarsh
Copy link
Member

Thanks, we probably need to check this against dummy-variable-rgx. Good first issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants