Class SingleTon(object):
__instance = None
def __init__(self):
pass
def __new__(cls):
if cls.__instance is not None:
cls.__instance =object.__new__(cls)
else:
return cls.__instance
python面试题六(写一个单例)
猜你喜欢
转载自blog.csdn.net/weixin520520/article/details/105335719
今日推荐
周排行