[Python-Dev] Making staticmethod objects callable?

Nicolas Fleury nidoizo at yahoo.com
Wed Mar 1 15:57:12 CET 2006


I've posted this question on comp.lang.python, but nobody seems to 
conclude it is a bad idea, so I post it here.

Basically, should staticmethods be made callable so that the following 
would not raise an exception:

class A:
     def foo(): pass
     bar = foo()

There's workarounds, but it's really just about usability.  staticmethod 
could still return a descriptor, but additionnally callable.  Is there 
something I'm missing?  Is it error-prone in any way?

Note that I'm not a big fan of static methods myself, but I understand 
users expecting this work.


More information about the Python-Dev mailing list