How to use a class property to store function variables?
bruno.42.desthuilliers at websiteburo.invalid
Wed Apr 28 04:08:56 EDT 2010
GZ a écrit :
> Ah, this totally works. The key is to use the staticmethod function.
staticmethod is not a function, it's a class.
> Another question: I am not sure how staticmethod works internally. And
> the python doc does not seem to say. What does it do?
It's easy to figure this out once you understand how Python turns
functions into methods: http://wiki.python.org/moin/FromFunctionToMethod
Basically, the staticmethod type acts as a descriptor wrapper around the
function object that short-circuits the function object's own descriptor
implementation and yields the function.
More information about the Python-list