I have this small example with parent/child classes. I know the code will run without problem, but is it a good practice to override a parent's method with a method which has a different signature? PyCharm does not seem to think it is a good idea:
Signature of method 'Daughter.do()' does not match signature of base method in class 'Mother'
For information, calling Parent method do should execute do(self) not do(self, c).
Code example:
class Parent:
def __init__(self):
self._a = "a"
def do(self):
print("Parent: {}".format(self._a))
class Child(Parent):
def __init__(self):
Parent.__init__(self)
self._b = "b"
def do(self, c):
print("Child: {}".format(self._a))
print("Child: {}".format(self._b))
print("Child: {}".format(c))