is it defining a singleton in the circuits is simple like this? I dont know the potential impact, are there any risks implement the singleton in this way?
class Singleton(Component):
__instance = None
def __new__(cls):
if cls.__instance is None:
cls.__instance = super(Singleton,cls).__new__(cls)
cls.__instance.__initialized = False
return cls.__instance
def __init__(self):
if(self.__initialized): return
self.__initialized = True
print ("INIT")