会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
dsprain
博客园
首页
新随笔
联系
订阅
管理
2020年12月28日
python类中cls,@classmethod,@staticmethod详解
摘要: @classmethod,@staticmethod是python内置的两个修饰符方法。 @classmethod修饰符对应的函数不需要实例化,不需要 self 参数,但第一个参数需要是表示自身类的 cls 参数,可以来调用类的属性,类的方法,实例化对象等。 class A(object): # 属
阅读全文
posted @ 2020-12-28 15:52 dsprain
阅读(779)
评论(0)
推荐(0)
公告