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

redeclared-assigned-name: Allow dummy variables instead of hard-coded underscore #3341

Closed
richardebeling opened this issue Jan 11, 2020 · 0 comments
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors

Comments

@richardebeling
Copy link

The check for redeclared-assigned-name has an exception hard-coded for _. If _ can not be used for unpacking return values, this is inconvenient. The check should instead allow all values that match the dummy-variables-rgx configuration.

Steps to reproduce

def some_method():
    return 1, 2, 3

_unused, a, _unused = some_method()

Run pylint --disable=all --enable=redeclared-assigned-name --dummy-variables-rgx='_unused' sample.py

Current behavior

************* Module sample
sample.py:4:0: W0128: Redeclared variable '_unused' in assignment (redeclared-assigned-name)

Expected behavior

no errors. _unused is a valid dummy variable name.

pylint --version output

pylint 2.4.4
astroid 2.3.3
Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0]

but the hard coded exception for "_" is still in master, so I don't see why any newer version would behave differently.

@AWhetter AWhetter added Good first issue Friendly and approachable by new contributors Enhancement ✨ Improvement to a component labels Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors
Projects
None yet
Development

No branches or pull requests

2 participants