[Python-checkins] cpython (3.4): docs: Document __objclass__. Closes #19281.

yury.selivanov python-checkins at python.org
Tue Apr 8 18:07:31 CEST 2014

changeset:   90185:0973d45197cc
branch:      3.4
parent:      90182:acbdbf2b06e0
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Tue Apr 08 12:03:07 2014 -0400
  docs: Document __objclass__. Closes #19281.

Initial patch by Nick Coghlan

  Doc/reference/datamodel.rst |  8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1467,6 +1467,14 @@
    Called to delete the attribute on an instance *instance* of the owner class.
+The :attr:`__objclass__` is interpreted by the :mod:`inspect` module as
+specifying the class where this object was defined (setting this appropriately
+can assist in runtime introspection of dynamic class attributes). For callables,
+it may indicate that an instance of the given type (or a subclass) is expected
+or required as the first positional argument (for example, CPython sets this
+attribute for unbound methods that are implemented in C).
 .. _descriptor-invocation:
 Invoking Descriptors

Repository URL: http://hg.python.org/cpython

More information about the Python-checkins mailing list