Behavior of staticmethod in Python 3

Chris Angelico rosuav at gmail.com
Sat Nov 23 22:38:56 CET 2013


On Sun, Nov 24, 2013 at 2:00 AM, Antoon Pardon
<antoon.pardon at rece.vub.ac.be> wrote:
> 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.

I absolutely agree. But isn't that already the case? I seem to be
missing something here.

>>> class Foo:
    @staticmethod
    def foo():
        pass

>>> callable(Foo.foo)
True
>>> callable(Foo().foo)
True

ChrisA



More information about the Python-list mailing list