def __init__(self, factoryMethod, disposeMethod=None):
        """
        --factoryMethod is the factory method called when the singleton instance is created:
          its parameters are (container, key)

        --disposeMethod is optional. If specified, it's called, if the instance was created,
          when the container's dispose() method is called; it takes a single parameter: (instance)
        """
        if factoryMethod is None:
            raise ValueError("Invalid factory method")

        self._factoryMethod = factoryMethod
        self._disposeMethod = disposeMethod
        self._instance = None
def __init__ ( self , factoryMethod , disposeMethod = None ) : if factoryMethod is None : raise ValueError ( "Invalid factory method" ) self . _factoryMethod = factoryMethod self . _disposeMethod = disposeMethod self . _instance = None
--factoryMethod is the factory method called when the singleton instance is created:
          its parameters are (container, key)

        --disposeMethod is optional. If specified, it's called, if the instance was created,
          when the container's dispose() method is called; it takes a single parameter: (instance)