Behavior of staticmethod in Python 3

Marco Buttu marco.buttu at gmail.com
Sat Nov 23 03:28:43 EST 2013


In Python 3 the following two classes should be equivalent:

$ cat foo.py
class Foo:
     def foo():
         pass
     print(callable(foo))

class Foo:
     @staticmethod
     def foo():
         pass
     print(callable(foo))

But they do not:

$ python3 foo.py
True
False

How come the metaclass does not skip the staticmethod decorator?
-- 
Marco Buttu



More information about the Python-list mailing list