Deutsch
Telegram

Threaddef good_singleton(class_: Type) -> Callable[..., Any]:

4 Nachrichten · –
⁣
def good_singleton(class_: Type) -> Callable[..., Any]: """ Singleton decorator. If instance of class already exists, raises ValueError. It blocks creating new instances of classes that should instantiate only once. """ instances: Dict[Type, Any] = {} def getinstance(*args, **kwargs) -> Any: if class_ not in instances: instances[class_] = class_(*args, **kwargs) return instances[class_] raise ValueError(f"Instance of {class_} already exists") return getinstance Я изобрел хороший синглтон!
      1. T
        мне кажется название функции пиздит
ССообщество Python ПрограммистовСообщество Python Программистов@python_scripts · Gruppe · Technik
4 169Mitglieder43schreiben in 30 Tagen
Community-Feed In Telegram öffnen

Ein offener öffentlicher Feed aus dem Suchindex ChatCrawler — „Google für das öffentliche Telegram“; wird aktualisiert, während die Community gecrawlt wird. Zeiten in UTC.

Nur öffentliche Inhalte, offizielle Telegram-API. Über uns · FAQ · Grenzen des Index · Seite entfernen · Katalog · Suche · So zählen wir