summaryrefslogtreecommitdiffstats
path: root/Doc/library/functions.rst
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-25 15:24:12 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2019-09-25 15:24:12 (GMT)
commit7444a5a402bbac4268b95958a9578a9e3dae33e0 (patch)
tree61dcc6fa5c6855ff97f76f8f92abb96b663afe0f /Doc/library/functions.rst
parente4be8c984d035da30f9ed051aa6f3f762f0e9060 (diff)
downloadcpython-7444a5a402bbac4268b95958a9578a9e3dae33e0.zip
cpython-7444a5a402bbac4268b95958a9578a9e3dae33e0.tar.gz
cpython-7444a5a402bbac4268b95958a9578a9e3dae33e0.tar.bz2
bpo-38255: super() can search attributes as well as methods (GH-16368) (GH-16391)
Improvement suggested by Géry Ogam. (cherry picked from commit 15ccc4fac09b866d61b069c6c136aabfe4bac09c) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r--Doc/library/functions.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 947a0e5..0236ff0 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1635,6 +1635,10 @@ are always available. They are listed here in alphabetical order.
super().method(arg) # This does the same thing as:
# super(C, self).method(arg)
+ In addition to method lookups, :func:`super` also works for attribute
+ lookups. One possible use case for this is calling :term:`descriptor`\s
+ in a parent or sibling class.
+
Note that :func:`super` is implemented as part of the binding process for
explicit dotted attribute lookups such as ``super().__getitem__(name)``.
It does so by implementing its own :meth:`__getattribute__` method for searching