What is a classmethod for?

Erik Max Francis max at alcyone.com
Sun Jun 2 20:50:28 EDT 2002

Dennis Peterson wrote:

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

It simply generalizes a case.  When you have a function associated with
a class, you might want the class passed in as another argument.  That
would facilitate, for instance, having the same function (converted to a
static method with staticmethod) act as a static method in multiple

 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Who'd ever think it / Such a squalid little ending
\__/ The American and Florence, _Chess_
    Church / http://www.alcyone.com/pyos/church/
 A lambda calculus explorer in Python.

More information about the Python-list mailing list