Dashboard
PHP:
8.3.33
OS:
Linux
User:
bioarquitetar
/
/
usr
/
lib
/
python3.9
/
site-packages
/
tuned
📤 Upload
📝 New File
📁 New Folder
Close
Editing: patterns.py
class Singleton(object): """ Singleton design pattern. """ _instance = None def __init__(self): if self.__class__ is Singleton: raise TypeError("Cannot instantiate directly.") @classmethod def get_instance(cls): """Get the class instance.""" if cls._instance is None: cls._instance = cls() return cls._instance
Save
Cancel