diff options
author | Stanislav (Stanley) Modrak <44023416+smith558@users.noreply.github.com> | 2023-08-25 04:52:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-25 11:52:13 +0800 |
commit | 73584a2e276cd52214f73443eda689c773973691 (patch) | |
tree | 038dde077195af979bd71f957b7d168abcf5a8fb /python.html.markdown | |
parent | f472504d5836fb9eae91a4f228bbfb4fb34af60a (diff) |
Clarify "Method Resolution Order" (#4687)
Diffstat (limited to 'python.html.markdown')
-rw-r--r-- | python.html.markdown | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/python.html.markdown b/python.html.markdown index d9eda60c..d9261ff2 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -876,7 +876,8 @@ if __name__ == '__main__': if type(sup) is Superhero: print('I am a superhero') - # Get the Method Resolution search Order used by both getattr() and super() + # Get the "Method Resolution Order" used by both getattr() and super() + # (the order in which classes are searched for an attribute or method) # This attribute is dynamic and can be updated print(Superhero.__mro__) # => (<class '__main__.Superhero'>, # => <class 'human.Human'>, <class 'object'>) @@ -958,8 +959,7 @@ class Batman(Superhero, Bat): if __name__ == '__main__': sup = Batman() - # Get the Method Resolution search Order used by both getattr() and super(). - # This attribute is dynamic and can be updated + # The Method Resolution Order print(Batman.__mro__) # => (<class '__main__.Batman'>, # => <class 'superhero.Superhero'>, # => <class 'human.Human'>, |