]> granicus.if.org Git - python/commitdiff
bpo-38255: super() can search attributes as well as methods (GH-16368)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Wed, 25 Sep 2019 15:13:19 +0000 (08:13 -0700)
committerGitHub <noreply@github.com>
Wed, 25 Sep 2019 15:13:19 +0000 (08:13 -0700)
Improvement suggested by Géry Ogam.

Doc/library/functions.rst

index 4d3b2f593c0f6d467a6ccbe6e67514ede79e7364..28d9c7b99e6f52ccaab36fcc8006fa876572d86b 100644 (file)
@@ -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