static class methods in Python?

Gordon McMillan gmcm at hypernet.com
Fri Feb 18 19:05:44 EST 2000


Neel asks:
> Gordon McMillan <gmcm at hypernet.com> wrote:
> > Greg Wilson asks:
> > > Have there been any proposals to add the equivalent of "static"
> > > methods (belonging to the class, not to instances) to Python?
> > 
> > The complaints vastly outnumber the proposals.
> > 
> > The most common complaint is the lack of C++ style static 
> > methods. These are usually greeted with hordes of ugly 
> > workarounds. 
> 
> This is probably a stupid question, but what /is/ a class method?
> I've never programmed in C++ (or Java), so an explanation would 
> be appreciated. 

A plain old function accessed through the class object. 
(Amazing what people will get excited about, isn't it?).

- Gordon




More information about the Python-list mailing list