static python classes ?

Bruno Desthuilliers bruno.42.desthuilliers at
Wed Jun 20 09:24:09 CEST 2007

Tom Gur a écrit :
>> Look for @staticmethod in
>> Example:
>> class C:
>>     @staticmethod
>>     def f(arg1, arg2, ...): ...
> Oops, sorry for the confusion - I've actually meant a static method,
> and Gerald's answer works fine.

FWIW, staticmethods in Python are of very restricted use - we have 
modules and functions for this. And you may be interested in 
classmethods (methods that takes the class object instead of the 
instance as first argument).

As a last word : trying to write Java in Python wis certainly not the 
best option. Better to learn to write Python.

More information about the Python-list mailing list