Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ Using the non-data descriptor protocol, a pure Python version of
def __get__(self, obj, cls=None):
if cls is None:
cls = type(obj)
if hasattr(obj, '__get__'):
if hasattr(self.f, '__get__'):
return self.f.__get__(cls)
return MethodType(self.f, cls)

Expand All @@ -1353,7 +1353,7 @@ Using the non-data descriptor protocol, a pure Python version of
>>> t.cm(11, 22)
(<class 'T'>, 11, 22)

The code path for ``hasattr(obj, '__get__')`` was added in Python 3.9 and
The code path for ``hasattr(self.f, '__get__')`` was added in Python 3.9 and
makes it possible for :func:`classmethod` to support chained decorators.
For example, a classmethod and property could be chained together:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed example python implementation of classmethod in the documentation of descriptor.