静态方法(staticmethod),类方法(classmethod)与实例方法

@classmethod 将方法转为类方法,类方法接收类cls做为隐式的第一个参数python class C: @classmethod def f(cls, arg1, arg2, ...): ... @staticmethod 将方法转换为静态方法,静态方法接收隐式的第一个参数。web 实例方法: 实例方法接收实例self做为隐式的第一个参数svg def foo(self,
相关文章
相关标签/搜索