From: Bruno Desthuilliers on 28 Apr 2010 04:08 GZ a �crit : (snip) > 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.
First
|
Prev
|
Pages: 1 2 3 Prev: How to check what is holding reference to object Next: PyCon Australia CFP: One Day Left! |