Behavior of staticmethod in Python 3
antoon.pardon at rece.vub.ac.be
Sun Nov 24 17:08:46 CET 2013
Op 24-11-13 12:03, Peter Otten schreef:
> 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
>>> 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
> [Python-Dev] Making staticmethod objects callable?
> Nicolas Fleury nidoizo at yahoo.com
> Wed Mar 1 15:57:12 CET 2006
> If you think you have compelling arguments, go ahead and explain them --
> preferably on python-ideas.
I am under no illusion that compelling arguments will make any difference.
People had argued for a ternary operator for years and it all fell on
deaf ears until finally a python developer was bitten by a nasty bug
while using one of the alternative that was always suggested here.
When you asked that python should behave following the principle of
least surprise and thus showed consistency where possible, the
standard trope was that a foolish consistency was the hobgoblin
of little minds.
I see no reason why this should go any way differently now.
More information about the Python-list