-
-
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
arguments-differ and default parameters #1482
Comments
Thanks for submitting an issue. What would you expect to be correct checker behaviour here (in terms of formal definition)? |
Tried to implement it, may look like:
A better implementation should probably also check if Obviously it broke at least a test, this one:
Which is the exact case I describe as being "probably legitimate". Test come from 3788944, it was the first test of this feature… I they exists, I'd like to hear arguments against this usage of "blindly passing maybe-changing-implementation-dependent arguments".
may look like:
|
For any beginner contributors looking at this: this is almost identical to #1553 so fixing one may fix the other. But this includes an extra test case where there are some named arguments mixed with *args, and **kwargs. You may also want to consider the case where positional and keyword arguments are both used with *args and **kwargs. For example |
@AWhetter, the code reference you gave shows that, even if ‘arguments-differ’ is avoided, some override methods would then fail with ‘signature-differs’. For example: class LoremIpsum:
def odio(self, elit):
print(elit)
class DolorSitAmet(LoremIpsum):
def odio(self, elit="adipiscing"):
super().odio(elit) The override method To be clear, the above code example is another one that I would not expect ‘arguments-differ’, nor ‘signature-differs’. The signature of |
Hello, is it fixed already? I am using py3.6 and pylint 2.2.2 and still getting a very similar error for this example - https://stackoverflow.com/a/54155637/4521646 |
No message is emitted if the overriding function provides positional or keyword variadics in its signature that can feasibly accept and pass on all parameters given by the overridden function. Closes pylint-dev#1482 Closes pylint-dev#1553
PR request #3001 fixes the original problem. The test mentioned by @JulienPalard I have simply changed to expect no messages emitted in that scenario. The |
No message is emitted if the overriding function provides positional or keyword variadics in its signature that can feasibly accept and pass on all parameters given by the overridden function. Closes pylint-dev#1482 Closes pylint-dev#1553
No message is emitted if the overriding function provides positional or keyword variadics in its signature that can feasibly accept and pass on all parameters given by the overridden function. Closes pylint-dev#1482 Closes pylint-dev#1553
For methods having hard-to-reach default values, their parameters may be hard to immitate, they sometimes even leak internal details that we do not want to imitate. I'm thinking of
collections.OrderedDict.__setitem__
but there may be a others:I think having a
*args, **kwargs
should be a sign of "I'm trying hard to be compatible, without depending on implementation details".Example:
This one (obviously) whines about
arguments-differ
, yet I'm doing everything to allow the implementation details to change while staying compatible. I'm not even loosing semantical information as I'm only obscursing implementation details.pylint --version output
The text was updated successfully, but these errors were encountered: