Português
Abrir no Telegram

Tópicoкому надо сломать - сломает

8 mensagens · –
    1. R
      зачем падать. вот тебе good_singleton. class Singleton(type): """ Singleton implementation. Example of usage: >>> class MyClass(metaclass=Singleton): ... pass >>> instance1 = MyClass() >>> instance2 = MyClass() >>> instance1 is instance2 # True """ _instances: dict[type, Any] = {} def __call__(cls, *args: Any, **kwargs: Any) -> Any: if cls not in cls._instances: cls._instances[cls] = super().__call__(*args, **kwargs) return cls._instances[cls]
        1. R
          class Singleton(type): _instances: dict[type, Any] = {} def __call__(cls, *args: Any, **kwargs: Any) -> Any: if cls not in cls._instances: cls._instances[cls] = super().__call__(*args, **kwargs) return cls._instances[cls] raise AssertionError(f"Cannot initialize more than one instance of class {cls.__name__}")
ССообщество Python ПрограммистовСообщество Python Программистов@python_scripts · grupo · Tecnologia
4 169membros43escrevendo em 30 dias
Feed da comunidade Abrir no Telegram

Um feed público aberto do índice de busca ChatCrawler — “o Google do Telegram público”; atualizado à medida que a comunidade é rastreada. Horários em UTC.

Somente conteúdo público, API oficial do Telegram. Sobre · Perguntas frequentes · Limites do índice · Remover uma página · Catálogo · Busca · Como calculamos