[Tutor] classmethod, staticmethod functions (decorator related)

Alan Gauld alan.gauld at btinternet.com
Mon Sep 13 03:01:13 CEST 2010

"Steven D'Aprano" <steve at pearwood.info> wrote

> A little more information... static methods are quite common[1] in 
> Java
> and C++, where people feel the need (or in the case of Java, are 
> forced
> by the language) to make every function a method.

static methods in C++ are normally reserved for use as class
methods (although with the "pollution" from Java that is slowly
changing). Java OTOH has made them much more common but
as substitutes for functions as well as true class methods - yeck!

They are also found in a slightly different guise in Delphi.

Python classmethods are more powerful and useful than either.

Alan G. 

More information about the Tutor mailing list