I am writing a class in python.
class my_class(object):
def __init__(self):
# build my objects
def foo(self,*args,**kwargs):
# do something with them
Then I would like to extend this class:
class my_extended_class(my_class):
But I can not figure out what is the correct way of accessing parent methods.
Shall I:
1) create an instance of a father object? at constructor time
def __init__(self):
self.my_father=my_class()
# other child-specific statements
return self
def foo(self,*args,**kwargs):
self.my_father.foo(*args,**kwargs)
# other child-specific statements
return self
2) call father methods 'directly'?
def foo(self,*args,**kwargs):
my_class.foo(*args,**kwargs)
# other child-specific statements
return self
3) other possible ways?