title: Destroying a Singleton object in Python
body: <p>I have a Singleton object in Python: </p>
  
  <pre><code>class Singleton(type):
      _instances = {}
  
      def __call__(cls, *args, **kwargs):
          if cls not in cls._instances:
              cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
          return cls._instances[cls]
  
      @classmethod
      def destroy(cls):
          del cls._instances[cls]
  
  
  class MockObject(metaclass=Singleton):
  
      def __init__(self, *args, **kwargs):
          # various things
  </code></pre>
  
  <p>I would like to destroy the object at some point, so I wrote a classmethod in the metaclass. However, the <code>cls</code> refers to the metaclass <code>Singleton</code> rather than <code>MockObject</code>. Is there a way to call the <code>destroy</code> function with a value of <code>MockObject</code>?</p>