Manual
Return a static method for function.
A static method does not receive an implicit first argument. To declare a static method, use this idiom:
class C:
@staticmethod
def f(arg1, arg2, ...): ...
The @staticmethod form is a function decorator – see the description of function definitions in Function definitions for details.
It can be called either on the class (such as C.f()) or on an instance (such as C().f()). The instance is ignored except for its class.
Static methods in Python are similar to those found in Java or C++. Also see classmethod() for a variant that is useful for creating alternate class constructors.
For more information on static methods, consult the documentation on the standard type hierarchy in The standard type hierarchy.
直译
为function返回一个静态方法
静态方法不接收隐式首参数,可以用以下语句来定义一个静态方法:
class C:
@staticmethod
def f(arg1, arg2, ...): ...
@staticmethod是函数装饰器形式,函数定义的描述详见函数定义
该方法既可以在类上调用(如C.f()),也可以在实例上调用(如C().f())。
Python中的静态方法与Java或C++的相似,同样classmethod()对于创建代替的类构造器也很有用。
更多静态方法的信息,查看标准类型层级