Commit b4f33d08 authored by Guido van Rossum's avatar Guido van Rossum

Correct the description of im_class. (Fred, this is changed in 2.2.

Should this be labeled as changed?  How?)
parent e5d5f6a1
...@@ -39,7 +39,7 @@ you can expect to find the following special attributes: ...@@ -39,7 +39,7 @@ you can expect to find the following special attributes:
\hline \hline
\lineiii{method}{__doc__}{documentation string} \lineiii{method}{__doc__}{documentation string}
\lineiii{}{__name__}{name with which this method was defined} \lineiii{}{__name__}{name with which this method was defined}
\lineiii{}{im_class}{class object in which this method belongs} \lineiii{}{im_class}{class object that asked for this method}
\lineiii{}{im_func}{function object containing implementation of method} \lineiii{}{im_func}{function object containing implementation of method}
\lineiii{}{im_self}{instance to which this method is bound, or \code{None}} \lineiii{}{im_self}{instance to which this method is bound, or \code{None}}
\hline \hline
......
...@@ -447,8 +447,8 @@ function). ...@@ -447,8 +447,8 @@ function).
Special read-only attributes: \member{im_self} is the class instance Special read-only attributes: \member{im_self} is the class instance
object, \member{im_func} is the function object; object, \member{im_func} is the function object;
\member{im_class} is the class that defined the method (which may be a \member{im_class} is the class of \member{im_self} for bound methods,
base class of the class of which \member{im_self} is an instance); or the class that asked for the method for unbound methods);
\member{__doc__} is the method's documentation (same as \member{__doc__} is the method's documentation (same as
\code{im_func.__doc__}); \member{__name__} is the method name (same as \code{im_func.__doc__}); \member{__name__} is the method name (same as
\code{im_func.__name__}). \code{im_func.__name__}).
...@@ -467,8 +467,8 @@ case (class attribute), the \member{im_self} attribute is \code{None}, ...@@ -467,8 +467,8 @@ case (class attribute), the \member{im_self} attribute is \code{None},
and the method object is said to be unbound; in the latter case and the method object is said to be unbound; in the latter case
(instance attribute), \method{im_self} is the instance, and the method (instance attribute), \method{im_self} is the instance, and the method
object is said to be bound. For object is said to be bound. For
instance, when \class{C} is a class which contains a definition for a instance, when \class{C} is a class which has a method
function \method{f()}, \code{C.f} does not yield the function object \method{f()}, \code{C.f} does not yield the function object
\code{f}; rather, it yields an unbound method object \code{m} where \code{f}; rather, it yields an unbound method object \code{m} where
\code{m.im_class} is \class{C}, \code{m.im_func} is \method{f()}, and \code{m.im_class} is \class{C}, \code{m.im_func} is \method{f()}, and
\code{m.im_self} is \code{None}. When \code{x} is a \class{C} \code{m.im_self} is \code{None}. When \code{x} is a \class{C}
...@@ -597,7 +597,6 @@ base class list. ...@@ -597,7 +597,6 @@ base class list.
When a class attribute reference would yield a user-defined function When a class attribute reference would yield a user-defined function
object, it is transformed into an unbound user-defined method object object, it is transformed into an unbound user-defined method object
(see above). The \member{im_class} attribute of this method object is the (see above). The \member{im_class} attribute of this method object is the
class in which the function object was found, not necessarily the
class for which the attribute reference was initiated. class for which the attribute reference was initiated.
\obindex{class} \obindex{class}
\obindex{class instance} \obindex{class instance}
...@@ -639,7 +638,7 @@ the search continues with the class attributes. If a class attribute ...@@ -639,7 +638,7 @@ the search continues with the class attributes. If a class attribute
is found that is a user-defined function object (and in no other is found that is a user-defined function object (and in no other
case), it is transformed into an unbound user-defined method object case), it is transformed into an unbound user-defined method object
(see above). The \member{im_class} attribute of this method object is (see above). The \member{im_class} attribute of this method object is
the class in which the function object was found, not necessarily the the
class of the instance for which the attribute reference was initiated. class of the instance for which the attribute reference was initiated.
If no class attribute is found, and the object's class has a If no class attribute is found, and the object's class has a
\method{__getattr__()} method, that is called to satisfy the lookup. \method{__getattr__()} method, that is called to satisfy the lookup.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment