For a Python novice, please can someone tell me what is happening here? Why is it printing "A init"?
If i remove the line super().__init__()
from __init__
function of class B
then the behaviour is as expected. But why is below code not an error, I though B
would not have a superclass??
class A:
def __init__(self):
print("A init")
class B:
def __init__(self):
super().__init__() # why is this line not an error
print("B init")
class C(B, A):
def __init__(self):
super().__init__()
print("C init")
c = C()
Output
A init
B init
C init
Process finished with exit code 0