diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-08-29 07:44:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-29 07:44:02 (GMT) |
commit | cd81f0500fe98c7f4cddb06530fffabd14f036b8 (patch) | |
tree | 416a0765db61e262efc9da2a137dcb240a8588c9 | |
parent | 122376df550b71dd3bec0513c7483cc1714212fa (diff) | |
download | cpython-cd81f0500fe98c7f4cddb06530fffabd14f036b8.zip cpython-cd81f0500fe98c7f4cddb06530fffabd14f036b8.tar.gz cpython-cd81f0500fe98c7f4cddb06530fffabd14f036b8.tar.bz2 |
bpo-23674: Clarify ambiguities in super() docs (#15564)
-rw-r--r-- | Doc/library/functions.rst | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index a7b6610..ce026eb 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -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 attribute is dynamic and can change whenever the inheritance hierarchy is updated. |