bpo-20751: Match variable name to the example. (GH-29980) · python/cpython@4ccccb1

@@ -1823,7 +1823,7 @@ Class Binding

1823182318241824

Super Binding

18251825

A dotted lookup such as ``super(A, a).x`` searches

1826-

``obj.__class__.__mro__`` for a base class ``B`` following ``A`` and then

1826+

``a.__class__.__mro__`` for a base class ``B`` following ``A`` and then

18271827

returns ``B.__dict__['x'].__get__(a, A)``. If not a descriptor, ``x`` is

18281828

returned unchanged.

18291829

@@ -1843,15 +1843,19 @@ Super Binding

18431843

x = 999

1844184418451845

def m(self):

1846-

'Demonstrate these two calls are equivalent'

1847-

result1 = super(A, a).x

1848-

result2 = B.__dict__['x'].__get__(a, A)

1846+

'Demonstrate these two descriptor invocations are equivalent'

1847+

result1 = super(A, self).x

1848+

result2 = B.__dict__['x'].__get__(self, A)

18491849

return result1 == result2

1850185018511851

.. doctest::

18521852

:hide:

1853185318541854

>>> a = A()

1855+

>>> a.__class__.__mro__.index(B) > a.__class__.__mro__.index(A)

1856+

True

1857+

>>> super(A, a).x == B.__dict__['x'].__get__(a, A)

1858+

True

18551859

>>> a.m()

18561860

True

18571861