class Singleton(object):
    def __new__(cls, *args, **kw):
        if not hasattr(cls, '_instance'):
            orig = super(Singleton, cls)
            cls._instance = orig.__new__(cls, *args, **kw)
        return cls._instance

 

posted on 2017-07-24 22:28  啊哈咧  阅读(156)  评论(0编辑  收藏  举报