Deutsch
Telegram

Threadкому надо сломать - сломает

8 Nachrichten · –
    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 · 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