说明: class Singleton(object): def __new__(cls, *args, **kwargs): if not hasattr(cls, 'instance'): cls.instance = super(Singleton, cls).__new__(cls) return cls.instance class MyClass(Singleton): def __init__(self, name): if name: self.name = name obj1 = M <gaoshiqi5322688> 上传 | 大小:275kb