Bug in the Reference Data Model

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*

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

Hi Georg, I'm glad to get your reply. Hard to imagine how a sophisticated document project like python reference is maintained. Your work is really appreciated. Cheer up and move on! Ted On Sun, Apr 14, 2013 at 5:54 PM, Georg Brandl <georg@python.org> wrote:
-----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-----
-- --- This information is automatically generated --- Welcome to My Blog : http://www.tedyin.com/blog/ ted.sybil aka. ymfoi aka. Ted Yin
participants (2)
-
Georg Brandl
-
Ted Yin