# 单例模式
class Boss(object):
__instance = None
__first = False
def __new__(cls, *args, **kwargs):
if not cls.__instance:
cls.__instance = object.__new__(cls)
return cls.__instance
def __init__(self, name):
if not self.__first:
self.name = name
self.__first = True
网友评论