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

_ variable should be ignored #17

Open
crsegerie opened this issue May 19, 2022 · 7 comments
Open

_ variable should be ignored #17

crsegerie opened this issue May 19, 2022 · 7 comments

Comments

@crsegerie
Copy link

_ is a convention for variable that are not used afterwards.

@crsegerie
Copy link
Author

I'm not taking about _* variables, only _ variables

@nhoad
Copy link
Owner

nhoad commented May 20, 2022

So to be clear, you're saying functions like this?

def foo(a, b, c, _):
    return a + b + c

@crsegerie
Copy link
Author

More like

def foo(a, b, c):
    _ = c
    return a + b 

_ should be ignored by default

@nhoad
Copy link
Owner

nhoad commented May 26, 2022

To make sure I understand, in this case we’d ignore the assignment to _, so then the c argument would be reported unused. Is that the behavior you’d want?

@FelipeLema
Copy link

I'm also in for def fn(a, b, c, _) not reporting error on _

if anything, report a warning if it's actually being used

@nhoad
Copy link
Owner

nhoad commented Jul 27, 2022

@FelipeLema that's a different request to what's being asked for here. What you're asking for is already supported - U101 is for unused arguments that start with an underscore, so you can simply start ignoring U101.

@FelipeLema
Copy link

oh, I didn't know that... thanks for noting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants