What is a class method?

John Nagle nagle at animats.com
Mon Aug 23 02:24:59 EDT 2010


On 8/22/2010 9:16 PM, James Mills wrote:
> 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.

     That reads like something the C++ standards revision committee
would dream up as they add unnecessary template gimmicks to the
language.

				John Nagle



More information about the Python-list mailing list