From 89439d426e32aa70391f1024e8a7d92bd9236193 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 28 Aug 2019 10:53:50 -0700 Subject: [PATCH 1/2] bpo-23674: Clarify ambiguities in super() docs --- Doc/library/functions.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index a7b6610ebdf1ed..7f0564cb7dd75e 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1589,8 +1589,15 @@ 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 *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 *type* lists the method resolution search order used by both :func:`getattr` and :func:`super`. The From ce291e47014c03713196abc759f1cdb305e33ffc Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Wed, 28 Aug 2019 16:34:44 -0700 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20wrong=20variable=20name=20(found=20by?= =?UTF-8?q?=20G=C3=A9ry=20Ogam)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Doc/library/functions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 7f0564cb7dd75e..ce026ebb4b0f56 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1599,7 +1599,7 @@ are always available. They are listed here in alphabetical order. ``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 *type* lists the method + 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.