What is a class method?
James Mills
prologic at shortcircuit.net.au
Mon Aug 23 00:16:42 EDT 2010
On Mon, Aug 23, 2010 at 1:53 PM, Paulo da Silva
<psdasilva.nospam at netcabonospam.pt> wrote:
> I did it before posting ...
> The "explanation" is not very clear. It is more like "how to use it".
Without going into the semantics of languages basically the
differences are quite clear:
@classmethod is a decorator that warps a function with
passes the class as it's first argument.
@staticmethod (much like C++/Java) is also a decorator that
wraps a function but does not pass a class or instance as
it's first argument.
I won't go into the use-cases as I don't use static or class
methods myself personally in any of my work (yet).
cheers
James
--
-- James Mills
--
-- "Problems are solved by method"
More information about the Python-list
mailing list