Skip to content

Instantly share code, notes, and snippets.

@rafaelhenrique
Last active August 29, 2015 14:25
Show Gist options
  • Save rafaelhenrique/711437120ef10a272206 to your computer and use it in GitHub Desktop.
Save rafaelhenrique/711437120ef10a272206 to your computer and use it in GitHub Desktop.
See method resolution order effects
class ClassA(object):
print("Class A")
def __init__(self):
print("Instance of A")
def test(self):
print("Test of A")
class ClassB(object):
print("Class B")
def __init__(self):
print("Instance of B")
def test(self):
print("Test of B")
class ClassC(object):
print("Class C")
def __init__(self):
print("Instance of C")
def test(self):
print("Test of C")
class BigSalad(ClassA, ClassB, ClassC):
def test(self, *args, **kwargs):
super(BigSalad, self).test(*args, **kwargs)
if __name__ == "__main__":
s = BigSalad()
s.test()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment