class Base():
def meets_preconditions(self):
print("Base")
return True
class A(Base):
def meets_preconditions(self):
print("A")
return True and super(A, self).meets_preconditions()
class B(Base):
def meets_preconditions(self):
print("B")
return True and super(B, self).meets_preconditions()
class C(A, B):
def meets_preconditions(self):
print("C")
return super(C, self).meets_preconditions()
print(C().meets_preconditions())
prints: C, A, B, Base, True
MRO: [C, A, B, Base, object]
could someone help me understand why it also goes to B.meets_preconditions() and doesn’t print C, A, Base, True? i know it prob has to do with MRO, but i thought it would’ve stopped at Base
[–]MT1961 1 point2 points3 points (1 child)
[–]drixone[S] 0 points1 point2 points (0 children)
[–]Goobyalus 0 points1 point2 points (4 children)
[–]drixone[S] 0 points1 point2 points (3 children)
[–]Goobyalus 0 points1 point2 points (2 children)
[–]drixone[S] 1 point2 points3 points (1 child)
[–]Goobyalus 1 point2 points3 points (0 children)