[Tutor] classmethod, staticmethod functions (decorator related)

Steven D'Aprano steve at pearwood.info
Mon Sep 13 01:27:56 CEST 2010


On Mon, 13 Sep 2010 09:13:25 am Steven D'Aprano wrote:
> On Mon, 13 Sep 2010 06:05:23 am Alan Gauld wrote:
> > I think static methjods are largely a mistake of history. ISTR They
> > were
> > introduced into python before class methods (not by much - one
> > release?)
>
> No, they were introduced at the same time. But it turned out that the
> use cases Guido van Rossum envisaged for them weren't as compelling
> as he first imagined. 

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.

Re Java, see this amusing discussion:

http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html




[1] For some definition of "common".

-- 
Steven D'Aprano


More information about the Tutor mailing list