python @staticmethod 注解,静态方法,可以省略类里那个self参数
Posted ~你曾说过分手后还能做炮友
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python @staticmethod 注解,静态方法,可以省略类里那个self参数相关的知识,希望对你有一定的参考价值。
class 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参数的主要内容,如果未能解决你的问题,请参考以下文章
python类方法@classmethod与@staticmethod