What is a classmethod for?

Dennis Peterson denpeterson at yahoo.com
Sun Jun 2 20:06:27 EDT 2002

> The point is that you can call class methods *without* creating an
> instance:


But you can do that with a static method:

class C:
    def foo(x):
        print x
    foo = staticmethod(foo)


...much like Java static methods. I see the point there, I'm just trying to
figure out the purpose of the implicit class object in classmethod.


More information about the Python-list mailing list