Let's say we have:
class Parent():
def __init__(self):
foo()
def foo(self):
//do stuff
class Child(Parent):
def __init__(self):
Parent.__init__()
class Grandchild(Child):
def __init__(self):
Child.__init__()
def foo(self):
//different stuff
There are a lot of classes at the Child
level that use the same foo()
. Grandchild
level has a slightly different version of foo
, but when Grandchild
is initiated, the foo()
call in Parent.__init__()
uses the Parent.foo()
instead of Grandchild.foo()
.
Is there a correct practice when in comes to this kind of situation?