summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2019-09-25 15:13:19 (GMT)
committerGitHub <noreply@github.com>2019-09-25 15:13:19 (GMT)
commit15ccc4fac09b866d61b069c6c136aabfe4bac09c (patch)
treeaa284b9d1f4d00bfd0251ca0fa1b8ec20a2b15ef /Doc
parent00508a7407d7d300b487532e2271534b20e378a7 (diff)
downloadcpython-15ccc4fac09b866d61b069c6c136aabfe4bac09c.zip
cpython-15ccc4fac09b866d61b069c6c136aabfe4bac09c.tar.gz
cpython-15ccc4fac09b866d61b069c6c136aabfe4bac09c.tar.bz2
bpo-38255: super() can search attributes as well as methods (GH-16368)
Improvement suggested by Géry Ogam.
Diffstat (limited to 'Doc')
-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 4d3b2f5..28d9c7b 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1637,6 +1637,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