I am trying to implement multiple hybrid inheritance in python, it is giving answer also but I am wondering what is the reason behind the sequence of the answer, for this code:
class GrandPa:
def __init__(self):
print("Grand Pa")
class Father(GrandPa):
def __init__(self):
super().__init__()
print("Father")
class Mother(GrandPa):
def __init__(self):
super().__init__()
print("Mother")
class child(Father, Mother):
def __init__(self):
super().__init__()
print("Child")
c = child()
OUTPUT
Grand Pa
Mother
Father
Child
In the child class we have taken Father class before the mother, so shouldn't Father be printed before Mother? Is there any logic behind this sequence?
c.__mro__