hi all:
In the svn thunk tree, I find in file Object/funcobject.c, the two
functions: sm_init and cm_init have a little different. the cm_init
function will check the object is really callable, but the sm_init
don't.
the code like this:
    if (!PyCallable_Check(callable)) {
        PyErr_Format(PyExc_TypeError, "'%s' object is not callable",
             callable->ob_type->tp_name);
        return -1;
    }

so when use staticmethod and classmethod on a class variable, there
are two different behavior.

class Test(object):
    name = "s7v7nislands"

name = classmethod(Test.name)   # will raise error.
name = staticmethod(Test.name)  #  will not raise error.


My idea is: here, the two functions (or maybe classes) should have the
same behavior).
so is this a bug or something I missing ?

thanks!

s7v7nislands
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to