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

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


http://hg.python.org/cpython/rev/2a953cb5642d
changeset:   90186:2a953cb5642d
parent:      90184:932d69ef0c63
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Tue Apr 08 12:04:04 2014 -0400
summary:
  docs: Document __objclass__. Closes #19281.

Initial patch by Nick Coghlan

files:
  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