PythonObjectOriented: Revision history

Jump to navigation Jump to search

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

3 November 2023

  • curprev 04:3804:38, 3 November 2023RobertBushman talk contribs 1,141 bytes +1,141 Created page with "Category:Python = Singleton = </syntaxhighlight lang="python" lines> import json from threading import Lock class SingletonMeta(type): _instances = {} _lock: Lock = Lock() def __call__(cls, *args, **kwargs): with cls._lock: if cls not in cls._instances: instance = super().__call__(*args, **kwargs) cls._instances[cls] = instance return cls._instances[cls] class DataManager(metaclass=Sin..."