Emulating classmethod in Python 2.1
Hamish Lawson
hbl at st-andrews.ac.uk
Thu Jun 6 20:00:47 EDT 2002
Franz GEIGER wrote:
> There's a receipe about this in the ASPN, by Alex Martelli. Concise
> and effective. Strongly recommended.
If you are referring to recipe 52304 [1], then I am in fact using this
to emulate staticmethod() where needed - I agree that it's a concise and
effective implementaion of staticmethod(). But Alex's recipe doesn't
emulate classmethod(), since the class is not passed through to the
method (notwithstanding the fact that Alex uses the terms 'class method'
and 'static method' interchangeably in his accompanying discussion -
although he wrote that before Python 2.2 made the distinction). Hence
the reason I'm still looking for an emulation of classmethod().
[1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52304
Hamish
More information about the Python-list
mailing list