[Python-checkins] bpo-20751: Match variable name to the example. (GH-29980)

rhettinger webhook-mailer at python.org
Tue Dec 7 22:38:39 EST 2021


https://github.com/python/cpython/commit/4ccccb1cfc1f30327e76a2d845cc274be56b34b1
commit: 4ccccb1cfc1f30327e76a2d845cc274be56b34b1
branch: main
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2021-12-07T21:38:21-06:00
summary:

bpo-20751: Match variable name to the example. (GH-29980)

files:
M Doc/reference/datamodel.rst

diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 597c8ec9f176b..81dad77fab97a 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1823,7 +1823,7 @@ Class Binding
 
 Super Binding
    A dotted lookup such as ``super(A, a).x`` searches
-   ``obj.__class__.__mro__`` for a base class ``B`` following ``A`` and then
+   ``a.__class__.__mro__`` for a base class ``B`` following ``A`` and then
    returns ``B.__dict__['x'].__get__(a, A)``.  If not a descriptor, ``x`` is
    returned unchanged.
 
@@ -1843,15 +1843,19 @@ Super Binding
         x = 999
 
         def m(self):
-            'Demonstrate these two calls are equivalent'
-            result1 = super(A, a).x
-            result2 = B.__dict__['x'].__get__(a, A)
+            'Demonstrate these two descriptor invocations are equivalent'
+            result1 = super(A, self).x
+            result2 = B.__dict__['x'].__get__(self, A)
             return result1 == result2
 
 .. doctest::
     :hide:
 
     >>> a = A()
+    >>> a.__class__.__mro__.index(B) > a.__class__.__mro__.index(A)
+    True
+    >>> super(A, a).x == B.__dict__['x'].__get__(a, A)
+    True
     >>> a.m()
     True
 



More information about the Python-checkins mailing list