do I have to implement __init__ in a subclass if the parameters are the same for the superclass? Like so:
Syntax: Select all
class SuperClass(object):
def __init__(self, param1):
self.param1 = param1
class SubClass(SuperClass):
# is this needed here? -- param1 is the same for SubClass and SuperClass
def __init__(self, param1):
super(SubClass, self).__init__(param1)
def new_method(self):
self.param1.method1()
Syntax: Select all
class SuperClass(object):
def __init__(self, param1):
self.param1 = param1
class SubClass(SuperClass):
def new_method(self):
self.param1.method1()
Edit: What about subclassing dicts and other python builtins? Does python 'know' if the object is a dict if I skip calling the constructor? :)