python @staticmethod 注解,静态方法,可以省略类里那个self参数
2021-01-30 20:16
标签:sel cme cti bsp func code use ++ this python @staticmethod 注解,静态方法,可以省略类里那个self参数 标签:sel cme cti bsp func code use ++ this 原文地址:https://www.cnblogs.com/DDBD/p/12819852.htmlclass staticmethod(object):
"""
staticmethod(function) -> method
Convert a function to be a static method.
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, ...):
...
It can be called either on the class (e.g. C.f()) or on an instance
(e.g. C().f()). The instance is ignored except for its class.
Static methods in Python are similar to those found in Java or C++.
For a more advanced concept, see the classmethod builtin.
"""
上一篇:多线程——生产者消费者问题
文章标题:python @staticmethod 注解,静态方法,可以省略类里那个self参数
文章链接:http://soscw.com/index.php/essay/49194.html