Source

dictionary_switches / code / Singleton / ClassVariableSingleton.py

Full commit
1
2
3
4
5
6
7
8
# Singleton/ClassVariableSingleton.py
class SingleTone(object):
    __instance = None
    def __new__(cls, val):
        if SingleTone.__instance is None:
            SingleTone.__instance = object.__new__(cls)
        SingleTone.__instance.val = val
        return SingleTone.__instance