-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
False positive in arguments-differ
rule when overriding an instance method with a static one
#6865
Comments
Why would you want to add |
As a signal to the reader that the self parameter is unused; is it a bad thing?
Or add a |
I personally don't think it should be used that way. Think of If it's just one implementation that happens to not use
Creating a new method isn't a "workaround", at least not if you think of it conceptually (see above). By their nature, true static- and instance methods are best if they are separate. |
That isn't right? Unlike, say, C#, Python can call static method through instances.
BUt it doesn't have to be that: instead it can be that a whole sub-hierarchy of the base class (multiple derived classes with a common parent) are not supposed to use |
Not everything you can do in Python is good practice ;)
I disagree. That's probably a bad code design. If a method is deals with a specific instance, it shouldn't use self. Even if the concrete implementation happens to not use In any case, you can still use |
Silence the rest of the recent pylint changes (most notably see pylint-dev/pylint#6865).
Bug description
Pylint complains about the following sample:
This is the reverse of #1482 . While overriding a static method with a non-static one is unsafe (the overriden method cannot be called directly on the class), it looks like the reverse (this issue) is safe:
Derived.xyz
can be called on bothDerived
andDerived
instances.Configuration
No response
Command used
Pylint output
Expected behavior
There should be no error reported for this case.
Pylint version
OS / Environment
Ubuntu 22.04 LTS
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: