staticmethod
Python でクラス関数を作成したい時に使用する。C++ で言う static の様なもんですな。
class A: def __staticMethod(v): print 'staticMethod: v =', v staticMethod = staticmethod(__staticMethod) def foo(self, v): print 'foo: v =', v # テスト A.staticMethod(10) staticMethod: v = 10 A.foo(10) # これはエラーになる # TypeError: unbound method foo() must be called with A instance as first argument (got int instance instead) a = A() a.foo(10) foo: v = 10 a.staticMethod(10) # これは実行できる staticMethod: v = 10