享元模式,对可以共享的属性对象进行共享,无法共享的属性独立存储。
class Obj:
def __init__(self, value):
self.content = value
def __str__(self):
return self.content
class Share(object):
def __init__(self):
super().__init__()
self.dct = {}