Class methods

Fredrik Lundh fredrik at
Wed Oct 5 21:02:09 CEST 2005

Class methods"Hughes, Chad O" wrote:

> Is there any way to create a class method?

somewhat ironically, the first google hit for that sentence is a chapter in the
python tutorial that *doesn't* explain how to create class methods...

as others have pointed out, the classmethod wrapper/descriptor is (probably)
what you want.  some additional reading:

also note that you may find that using a function at the module level leads to
nicer code than using a classmethod/staticmethod, especially if you look at
things from the caller's perspective.


More information about the Python-list mailing list