["python","class","inheritance","constructor","superclass"]
How to invoke the super constructor in Python?

class A: def __init__(self): print("world") class B(A): def __init__(self): print("hello") B() # output: hello In all other languages I've worked with the super constructor is invoked implicitly. How does one invoke it in Python? I would expect super(self) but this doesn't work.
In line with the other answers, there are multiple ways to call super class methods (including the constructor), however in Python 3 the process has been simplified: Python 3 class A(object): def __init__(self): print("world") class B(A): def __init__(self): print("hello") super().__init__() Python 2 In Python 2, you have to call the slightly more verbose version super(<containing classname>, self), which is equivalent to super()as per the docs. class A(object): def __init__(self): print "world" class B(A): def __init__(self): print "hello" super(B, self).__init__()