title: Using __delitem__ with a class object rather than an instance in Python
body: <p>I'd like to be able to use <code>__delitem__</code> with a class-level variable.
  My use case can be found <a href="https://stackoverflow.com/questions/20085823/memoize-a-function-so-that-it-isnt-reset-when-i-rerun-the-file-in-python">here</a> (the answer that uses <code>_reg_funcs</code>) but it basically involves a decorator class keeping a list of all the functions it has decorated. Is there a way I can get the class object to support <code>__delitem__</code>? I know I could keep an instance around specially for this purpose but I'd rather not have to do that.</p>
  
  <pre><code>class Foo(object):
      _instances = {}
  
      def __init__(self, my_str):
          n = len(self._instances) + 1
          self._instances[my_str] = n
          print "Now up to {} instances".format(n)
  
      @classmethod
      def __delitem__(cls, my_str):
          del cls._instances[my_str]
  
  
  abcd = Foo('abcd')
  defg = Foo('defg')
  
  print "Deleting via instance..."
  del abcd['abcd']
  print "Done!\n"
  
  print "Deleting via class object..."
  del Foo['defg']
  print "You'll never get here because of a TypeError: 'type' object does not support item deletion"
  </code></pre>