Source code for podspy.utils.patterns

#!/usr/bin/env python

"""This is the example module.

This module does stuff.
"""

__all__ = [
    'Singleton'
]


[docs]class Singleton(object): _instances = {} def __new__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__new__(cls, *args, **kwargs) return cls._instances[cls]