-
-
Save adeak/b7b126ef3085514f9af9e87cace3bd50 to your computer and use it in GitHub Desktop.
Aran MRO example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ABC: pass | |
class Widg(ABC): pass | |
class Cont(Widg): pass | |
class SCont(Cont): pass | |
class Top(Widg): pass | |
class Win(Top, SCont): pass | |
Win() | |
# >>> Top.mro() | |
# [<class '__main__.Top'>, <class '__main__.Widg'>, <class '__main__.ABC'>, <class 'object'>] | |
# | |
# >>> SCont.mro() | |
# [<class '__main__.SCont'>, <class '__main__.Cont'>, <class '__main__.Widg'>, <class '__main__.ABC'>, <class 'object'>] | |
# | |
# >>> Win.mro() | |
# [<class '__main__.Win'>, <class '__main__.Top'>, <class '__main__.SCont'>, <class '__main__.Cont'>, <class '__main__.Widg'>, <class '__main__.ABC'>, <class 'object'>] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment