Advertisement
LukeSavefrogs

Untitled

Sep 6th, 2023 (edited)
798
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. class Parent1:
  2.     def __init__(self):
  3.         print("Parent1.__init__")
  4.         super().__init__()
  5.  
  6. class Parent2:
  7.     def __init__(self):
  8.         print("Parent2.__init__")
  9.         super().__init__()
  10.  
  11. class Child(Parent1, Parent2):
  12.     def __init__(self):
  13.         print("Child.__init__")
  14.         super().__init__()
  15.  
  16. if __name__ == '__main__':
  17.     print(Child.__mro__)
  18.     Child()
  19.  
  20. # Output:
  21. #   (<class '__main__.Child'>, <class '__main__.Parent1'>, <class '__main__.Parent2'>, <class 'object'>)
  22. #   Child.__init__
  23. #   Parent1.__init__
  24. #   Parent2.__init__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement