I'm subclassing a class that I made, and in the subclass I'm overriding a method of the parent class. For this particular method the linter complains about mismatch in signatures between this implementation and the implementation of the base method. In many other methods I don't see it complaining even though there's mismatch, what's the catch? and why is it good to match the signatures?
Asked
Active
Viewed 1,742 times
0
-
Could you also show the signature for the `evaluate` method in the `BaseModel` class you're inheriting from? – Mihai Chelaru Apr 20 '20 at 23:31
-
Please read [why an image of your code is not acceptable](https://idownvotedbecau.se/imageofcode). – tacoshy Jul 02 '22 at 12:51
1 Answers
3
I've seen this before too. Assuming you don't want them to match, e.g. you're extending the params the method takes, then you can just ignore or suppress this warning. I think it's there to try to warn you that you might have code that's incompatible but IMO it's not very helpful in most cases.
See also Python Method overriding, does signature matter? for a decent explanation of why the warning might be useful.

Tom Dalton
- 6,122
- 24
- 35