summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-25 08:24:24 -0700
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2019-09-25 08:24:24 -0700
commit3b5e9241142d6b7c22059115c0e68a8912753818 (patch)
tree094b6fdcf4a0341db4657b3c70164e90423c8c00
parentd3666945d78508970002653c4d46221a4306f55b (diff)
downloadcpython-git-3b5e9241142d6b7c22059115c0e68a8912753818.tar.gz
bpo-38255: super() can search attributes as well as methods (GH-16368) (GH-16392)
Improvement suggested by Géry Ogam. (cherry picked from commit 15ccc4fac09b866d61b069c6c136aabfe4bac09c) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
-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 313dbffdcd..06ba323ca3 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1532,6 +1532,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