[Python-Dev] Making staticmethod objects callable?

Guido van Rossum guido at python.org
Thu Mar 2 02:31:57 CET 2006


On 3/1/06, Nicolas Fleury <nidoizo at yahoo.com> wrote:
> The problem is that even after explaining descriptors (which IMHO can be
> a more advanced feature for newbies), you still need a workaround and
> you might end up with (or call __get__):
>
> class A:
>      def foo(): pass
>      bar = foo()
>      foo = staticmethod(foo)
>
> Which I find sad considering all the energy debating @decorators;)

In which context did you find a need for defining a static method and
calling it inside the class definition? I'm guessing that what you're
playing dubious scoping games.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list