]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-20751: Match variable name to the example. (GH-29980)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Wed, 8 Dec 2021 03:38:21 +0000 (21:38 -0600)
committerGitHub <noreply@github.com>
Wed, 8 Dec 2021 03:38:21 +0000 (21:38 -0600)
Doc/reference/datamodel.rst

index 597c8ec9f176b7f6ac16693f2424b5ad22671961..81dad77fab97a20502f8f18e0c76ddf120e0ef98 100644 (file)
@@ -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