Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-23674: Clarify ambiguities in super() docs #15564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 29, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1589,10 +1589,17 @@ are always available. They are listed here in alphabetical order.

Return a proxy object that delegates method calls to a parent or sibling
class of *type*. This is useful for accessing inherited methods that have
been overridden in a class. The search order is same as that used by
:func:`getattr` except that the *type* itself is skipped.
been overridden in a class.

The :attr:`~class.__mro__` attribute of the *type* lists the method
The *object-or-type* determines the :term:`method resolution order`
to be searched. The search starts from the class right after the
*type*.

For example, if :attr:`~class.__mro__` of *object-or-type* is
``D -> B -> C -> A -> object`` and the value of *type* is ``B``,
then :func:`super` searches ``C -> A -> object``.

The :attr:`~class.__mro__` attribute of the *object-or-type* lists the method
resolution search order used by both :func:`getattr` and :func:`super`. The
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
resolution search order used by both :func:`getattr` and :func:`super`. The
The :attr:`~class.__mro__`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the wording that references both getattr and super. Those two are deeply related.

attribute is dynamic and can change whenever the inheritance hierarchy is
updated.
Expand Down