[Python-checkins] cpython (2.7): The im_class of unbound class methods is actually not the same as im_self.
georg.brandl
python-checkins at python.org
Sun Apr 14 11:55:29 CEST 2013
http://hg.python.org/cpython/rev/c15a92210b48
changeset: 83350:c15a92210b48
branch: 2.7
user: Georg Brandl <georg at python.org>
date: Sun Apr 14 11:53:36 2013 +0200
summary:
The im_class of unbound class methods is actually not the same as im_self.
files:
Doc/reference/datamodel.rst | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -623,9 +623,8 @@
single: im_self (method attribute)
When a user-defined method object is created by retrieving a class method object
- from a class or instance, its :attr:`im_self` attribute is the class itself (the
- same as the :attr:`im_class` attribute), and its :attr:`im_func` attribute is
- the function object underlying the class method.
+ from a class or instance, its :attr:`im_self` attribute is the class itself, and
+ its :attr:`im_func` attribute is the function object underlying the class method.
When an unbound user-defined method object is called, the underlying function
(:attr:`im_func`) is called, with the restriction that the first argument must
@@ -797,8 +796,8 @@
associated class is either :class:`C` or one of its base classes, it is
transformed into an unbound user-defined method object whose :attr:`im_class`
attribute is :class:`C`. When it would yield a class method object, it is
- transformed into a bound user-defined method object whose :attr:`im_class`
- and :attr:`im_self` attributes are both :class:`C`. When it would yield a
+ transformed into a bound user-defined method object whose
+ :attr:`im_self` attribute is :class:`C`. When it would yield a
static method object, it is transformed into the object wrapped by the static
method object. See section :ref:`descriptors` for another way in which
attributes retrieved from a class may differ from those actually contained in
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list