[Python] Creating a singleton in a base class for it's derivative classes
Closed this issue · 0 comments
Wolfmyths commented
Our config managers which are in charge of reading/writing data are singleton classes.
Here's an example what makes them a singleton.
def __new__(cls) -> Self:
if not hasattr(cls, 'instance'):
cls.instance = super(ProfileManager, cls).__new__(cls)
return cls.instance
What I want is the base class Config
to have this feature so there is less repeated code.
This issue takes place in save.py