Behavior of staticmethod in Python 3

Peter Otten __peter__ at web.de
Sun Nov 24 06:03:04 EST 2013


Antoon Pardon wrote:

> Op 23-11-13 10:01, Peter Otten schreef:
> 
>> 
>> Your script is saying that a staticmethod instance is not a callable
>> object. It need not be because
>> 
>> Foo.foo()
>> 
>> doesn't call the Foo.foo attribute directly, it calls
>> 
>> Foo.foo.__get__(None, Foo)()
> 
> I think you are burdening the programmer with implemantation details
> that don't matter to him.

Replacing "you" in your statement with "python" I was about to suggest to 
make staticmethod(func) callable when I found this had already been 
rejected:

[Python-Dev] Making staticmethod objects callable?
Nicolas Fleury nidoizo at yahoo.com 
 Wed Mar 1 15:57:12 CET 2006

https://mail.python.org/pipermail/python-dev/2006-March/061948.html

If you think you have compelling arguments, go ahead and explain them -- 
preferably on python-ideas.




More information about the Python-list mailing list