[docs] Bug in the Reference Data Model
Ted Yin
ted.sybil at gmail.com
Thu Feb 2 05:53:42 CET 2012
It's said that :
When it would yield a class method object, it is transformed into a bound
user-defined method object whose im_class and im_self attributes are both C.
in the Reference <http://docs.python.org/reference/datamodel.html>
And I did an EX.
>>> class C(object) :
... @classmethod
... def cm(cls) : print cls
...
>>> C.cm
<bound method type.cm of <class '__main__.C'>>
>>> C.cm.im_self
<class '__main__.C'>
>>> C.cm.im_class
<type 'type'>
It's not hard for me to understand the result.
But unfortunately, in the reference, it's told that im_self should be *the
same* as im_class.
And in my opinion , 'im_self' shold be C, but im_class is 'type' since C's
metaclass is type. So they're obviously *not* 'both C'.
--
[This information is automatically generated]
*ted.sybil* aka. *ymfoi* aka. *Ted Yin*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20120202/b98e3466/attachment-0001.html>
More information about the docs
mailing list