Behavior of staticmethod in Python 3

Antoon Pardon antoon.pardon at rece.vub.ac.be
Sat Nov 23 10:00:29 EST 2013


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.

IMO if Foo.foo() is legal then Foo.foo is callable. That the actual call
is delegated to Foo.foo.__get__(None, Foo) shouldn't matter.

-- 
Antoon Pardon



More information about the Python-list mailing list