title: Python 3, super.__del__()
body: <p>I have a <code>__del__</code> method in a class I've defined, to delete some C++ objects created by calling C++ new in a ctypes interface. I want to delete these objects when an instance of my class is destroyed. I have a fragment of the class shown here:</p>
  
  <pre><code>class Graph(QtCore.QObject):
      def __init__(self):
          super().__init__()
          #list of objects created by calls to ctypes to create pointers to C++ objects which are instantiated with C++ new 
          self.graphs = []
  
      def __del__(self):
          print("in delete method")
          for graph in self.graphs:
              # call the C++ delete to free the storage used by this graph
              myctypes.graphDelete(graph)
          super().__del__()
  </code></pre>
  
  <p>When an instance of my Graph class is deleted, the <code>__del__</code> method is called and I see my print statement and when I set a breakpoint in the destructor method in the C++ code, as expected, it deletes the object. However, when my <code>__del__</code> method calls <code>super().__del__()</code>, I get the error message:</p>
  
  <pre><code>super().__del__()
  AttributeError: 'super' object has no attribute '__del__'
  </code></pre>
  
  <p>How do I ensure that the parent class (QtCore.QObject) is deleted if I define my own <code>__del__</code> method in the child class or will the parent class be deleted automatically?</p>