def __init__(self): """ Create singleton instance """ # Check whether we already have an instance if ReductionSingleton.__instance is None: # Create and remember instance ReductionSingleton.__instance = Reducer() # Store instance reference as the only member in the handle self.__dict__['_ReductionSingleton__instance'] = ReductionSingleton.__instance
def clean(cls, reducer_cls=None): if reducer_cls == None: ReductionSingleton.__instance = Reducer() else: ReductionSingleton.__instance = reducer_cls()