会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
小鱼biubiu
博客园
首页
新随笔
联系
订阅
管理
2020年5月16日
Python-类和对象(__new__,__init__,classmethod)
摘要: class Singleton(object): def __new__(cls): # 关键在于这,每一次实例化的时候,我们都只会返回这同一个instance对象 if not hasattr(cls, 'instance'): cls.instance = super(Singleton, cl
阅读全文
posted @ 2020-05-16 15:45 小鱼biubiu
阅读(473)
评论(0)
推荐(0)
编辑
公告