-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
keyword-arg-before-vararg should not be raised with python2 #1835
Comments
Wanted to improve pylint to latest version so that we all were up to date. Had to ignore 2 errors in `.pylintrc`: superfluous-parens, keyword-arg-before-vararg, Because they don't play nice with python 2. `superfluous-parens` gets raised when using print(), whilst `keyword-arg-before-vararg`'s solution results in a python2 `SyntaxError`; see this [ticket](pylint-dev/pylint#1835).
While the solution is a syntax error in Python 2, the code is still faulty as per the description of the message. There will be no way to pass |
@PCManticore hey thanks so much! you are right |
* keyword-arg-before-vararg: cf pylint-dev/pylint#1835 * inconsistent-return-statements
@PCManticore what if I want the |
It's not a great solution because the defaults aren't included in the function signature but I would do the following in this case: kwargs.setdefault('b', 1)
kwargs.setdefault('c', 2) It's not ideal, but mixing keyword arguments and variable arguments can get messy really quickly. So I think that using setdefault is a better solution, especially if you document the new default value in the docstring. This is a matter of opinion though so feel free to add a new option to cover this case. The 1.9 branch is where the Python 2 compatible version exists. |
Steps to reproduce
SyntaxError
:Current behavior
As per 1.8.1 release notes:
Expected behavior
I think this warning shouldn't be raised in python2.
pylint --version output
The text was updated successfully, but these errors were encountered: