Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d3f918c

Browse files
committed
docs: Document __objclass__. Closes #19281.
Initial patch by Nick Coghlan
1 parent 0fceaf4 commit d3f918c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Doc/reference/datamodel.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,14 @@ class' :attr:`__dict__`.
14671467
Called to delete the attribute on an instance *instance* of the owner class.
14681468

14691469

1470+
The :attr:`__objclass__` is interpreted by the :mod:`inspect` module as
1471+
specifying the class where this object was defined (setting this appropriately
1472+
can assist in runtime introspection of dynamic class attributes). For callables,
1473+
it may indicate that an instance of the given type (or a subclass) is expected
1474+
or required as the first positional argument (for example, CPython sets this
1475+
attribute for unbound methods that are implemented in C).
1476+
1477+
14701478
.. _descriptor-invocation:
14711479

14721480
Invoking Descriptors

0 commit comments

Comments
 (0)