Skip to content
Snippets Groups Projects
MetaSingleton.py 289 B
Newer Older
Anton Gusev's avatar
Anton Gusev committed
class MetaSingleton(type):
    _instances = {}

    def __call__(cls, *args, **kwargs):
        print('__call__ __MetaSingleton')
        if cls not in cls._instances:
            cls._instances[cls] = super(MetaSingleton, cls).__call__(*args, **kwargs)
        return cls._instances[cls]