fork(2) download
  1. class A:
  2. def __init__(self):
  3. print("Hello A:{}".format(self))
  4.  
  5. def somefunc(self):
  6. print("A Something!")
  7. super().somefunc()
  8.  
  9. class B:
  10. def __init__(self):
  11. print("Hello B:{}".format(self))
  12.  
  13. def somefunc(self):
  14. print("B Something!")
  15. try:
  16. super().somefunc()
  17. except AttributeError:
  18. print("End of MRO chain")
  19.  
  20. class C(A,B):
  21. pass
  22.  
  23. class D(B,A):
  24. pass
  25.  
  26.  
  27. xx=C()
  28. xx.somefunc()
  29. D().somefunc()
Success #stdin #stdout 0.02s 5824KB
stdin
Standard input is empty
stdout
Hello A:<__main__.C object at 0xb72f4f0c>
A Something!
B Something!
End of MRO chain
Hello B:<__main__.D object at 0xb72f4fec>
B Something!
A Something!
End of MRO chain