> > > My question is really: assuming that we redesign > staticmethod/classmethod anyway, should we make them callable? >
I think so. staticmethod and classmethod should affect descriptor behavior. And it should behave as normal function. >>> @classmethod ... def foo(cls): ... print(cls) ... >>> @staticmethod ... def bar(arg): ... print(arg) ... >>> foo(int) # this should work Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'classmethod' object is not callable >>> bar(42) # this should work too Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'staticmethod' object is not callable When Python 4, I think we can even throw away classmethod and staticmethod object. PyFunction can have binding flag instead, like METH_CLASS and METH_STATIC for PyCFunction. classmethod and staticmethod is just a function which modify the flag. But I'm not sure. Calling in Python is too complicated to fully understand. Regards, -- INADA Naoki <songofaca...@gmail.com>
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/