Python 2.7
I would like to automotically call a function of a parent object after I instantiate its child
class Mother:
def __init__(self):
pass
def call_me_maybe(self):
print 'hello son'
class Child(Mother):
def __init__(self):
print 'hi mom'
# desired behavior
>>> billy = Child()
hi mom
hello son
Is there a way I can do this?
Edit, from a comment below:
"i should have made it more clearer in my question, what i really want is some sort of 'automatic' calling of the parent method triggered solely by the instantiation of the child, with no explicit calling of the parent method from the child. I was hoping there would be some sort of magic method for this but i dont think there is."