[Tutor] static method

Joseph J. Strout joe@strout.net
Wed, 8 Dec 1999 07:25:31 -0800


At 4:18 PM +0100 12/8/99, Sergio Murru wrote:

>The question is: How can I implement a static method in python??

You can't.

But, a typical organization is to put one class (or a few closely 
related classes) into one file (aka one "module").  Put what you 
would have as a static method, as a "global" function in that module 
instead.  It's not really global; it's in the module's scope, so it's 
really just as good as a static method.  You can even make it 
"private" by starting its name with an underscore (names which start 
with an underscore are not normally imported by other modules).

Cheers,
-- Joe

,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |
|    joe@strout.net           http://www.macwebdir.com/            |
`------------------------------------------------------------------'