[docs] Bug in the Reference Data Model

Georg Brandl georg at python.org
Sun Apr 14 11:54:06 CEST 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 02.02.2012 05:53, schrieb Ted Yin:
> 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'.

Hi Ted,

thanks for the report, this has now been (belatedly) fixed and should
appear online soon.

cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEUEARECAAYFAlFqfL4ACgkQN9GcIYhpnLA6IgCYyKJG4tP9DQu4pKmgsYsdbV0l
LgCdHa43mO+x62CrniBTC0wr07/5oVU=
=XCYb
-----END PGP SIGNATURE-----


More information about the docs mailing list