class Singleton:
instance = None
def __new__(cls):
if cls.instance is None:
cls.instance = super().__new__(cls) # <-- данная строчка вызывает проблемы
return cls.instance
a = Singleton()
b = Singleton()
print(a is b) # True
def __new__(cls):
if cls.instance is None:
cls.instance = object.__new__(cls)
return cls.instance
class ClassA:
pass
instance = object.__new__(ClassA) # <ClassA object at 0x0....>