6
Dlaczego wzorzec Borg jest lepszy niż wzorzec Singleton w Pythonie
Dlaczego wzór Borga jest lepszy niż wzór Singletona ? Pytam, ponieważ nie widzę, aby skutkowały czymś innym. Borg: class Borg: __shared_state = {} # init internal state variables here __register = {} def __init__(self): self.__dict__ = self.__shared_state if not self.__register: self._init_default_register() Singel: class Singleton: def __init__(self): # init internal state …