This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Stuart
Recipients Stuart
Date 2013-01-21.17:49:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1358790552.82.0.446038520087.issue17008@psf.upfronthosting.co.za>
In-reply-to
Content
I emulated a real classmethod using python:

class cm(object):
    def __init__(self, o):
        self.o = o
    def __get__(self, obj, type=None):
        return self.o.__get__(obj, type)

then I check whether it is workable in the interactive mode and it is working:

Python 2.7.3 (default, Sep 26 2012, 21:53:58) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(cls):
...     print cls
... 
>>> cm = cm(foo)
>>> cm.__get__(int, type)
<bound method type.foo of <type 'int'>>

then I tried it in the real class but it failed:

>>> class C(object):
...     @cm
...     def foo(cls):
...         print cls
... 
>>> C.foo
<unbound method C.foo>
History
Date User Action Args
2013-01-21 17:49:12Stuartsetrecipients: + Stuart
2013-01-21 17:49:12Stuartsetmessageid: <1358790552.82.0.446038520087.issue17008@psf.upfronthosting.co.za>
2013-01-21 17:49:12Stuartlinkissue17008 messages
2013-01-21 17:49:12Stuartcreate