Can I define "static" (like in C++) methods in Python?

Erik Max Francis max at alcyone.com
Thu Apr 10 23:12:24 EDT 2003


sdieselil wrote:

> Can I define methods which are attributes of class and not attributes
> of
> instance?

Oops, I missed the part about methods in there.  Sorry about that.  As
other people have pointed out, the right way to do that (with modern
versions of Python) is staticmethod.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ The basis of optimism is sheer terror.
\__/ Oscar Wilde
    Rules for Buh / http://www.alcyone.com/max/projects/cards/buh.html
 The official rules to the betting card game, Buh.




More information about the Python-list mailing list