剑指offer python版 实现单例模式

class singleTon(object):
    def __init__(self,x):
        self.val=x
        
single2=singleTon(2)

a=single2
b=single2

print(a==b)

print(a.val)

a.val=334

print(b.val)
原文地址:https://www.cnblogs.com/xzm123/p/9847787.html