On Tue, 21 Jun 2005 16:52:09 -0400, Chuck Allison wrote
(in article <[EMAIL PROTECTED]>):

> Sorry for the elementary question: I was wondering if someone could
> explain the difference to me between class and static methods. Coming
> from other languages, I'm used to static methods, but not "class
> methods". Thanks.
> 
> 

Does this help (from the QR)?

Static methods : Use staticmethod(f) to make method f(x) static (unbound).
Class methods: like a static but takes the Class as 1st argument => Use f = 
classmethod(f) to make method f(theClass, x) a class method.

The decorators @staticmethod and @classmethod replace more elegantly the 
equivalent declarations f = staticmethod(f) and f = classmethod(f).

Lee C


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to