一、内置装饰器
内置装饰器 |
含义 |
classmethod |
类方法 |
staticmethod |
静态方法 |
二、普通方法(回顾)
# 1. 定义类
class MethodsDemo:
param_a = 0 # 类变量
def normal_demo(self): # 定义一个类方法,第一个参数必须为self
"""
普通方法
:return:
"""
print("这是一个普通方法", self.param_a)
# 2. 调用
md = MethodsDemo()
md.normal_demo()
三、类方法