摘要: class Singleton(type): def __call__(cls, *args, **kwargs): print "Singleton call" if not hasattr(cls, 'instance'): cls.instance = super(Singleton, cls).__call__(*args, **kwargs) return cls.instance def __new__(cls, name, bases, dct): print "Singleton new"... 阅读全文
posted @ 2013-02-05 09:29 鸪斑兔 阅读(1886) 评论(1) 推荐(0) 编辑
点击右上角即可分享
微信分享提示