Make staticmethod objects callable?
Nicolas Fleury
nid_oizo at yahoo.com_remove_the_
Tue Feb 28 17:56:11 EST 2006
Felipe Almeida Lessa wrote:
> Em Ter, 2006-02-28 às 15:17 -0500, Nicolas Fleury escreveu:
>
>>class A:
>> @staticmethod
>> def foo(): pass
>> bar = foo()
>
>
> # Why not:
>
> def foo(): pass
>
> class A:
> bar = foo()
> foo = staticmethod(foo)
>
Well, you could even do:
class A:
def foo(): pass
bar = foo()
staticmethod(foo)
But it's a bit sad to have a special syntax for decorators then. It's a
usability problem, nothing to do with functionality. There's obvious
workarounds, but IMHO any user saying "it should just work" is at least
partly right.
Regards,
Nicolas
More information about the Python-list
mailing list