title: Python destructor called in the "wrong" order based on reference count
body: <p>As far as I understand Python destructors should be called when the reference count of an object reaches 0. But this assumption seems not to be correct. Look at the following code:</p>
  <pre><code>class A:
      def __init__(self, b):
          self.__b = b
          print(&quot;Construct A&quot;)
          
      def __del__(self):
          # It seems that the destructor of B is called here.
          print(&quot;Delete A&quot;)
          # But it should be called here
          
  class B:
      def __init__(self):
          print(&quot;Construct B&quot;)
          
      def __del__(self):
          print(&quot;Delete B&quot;)
          
  b = B()
  a = A(b)
  </code></pre>
  <p>Outputs</p>
  <pre><code>Construct B                                                                                                                                                                                                                                   
  Construct A                                                                                                                                                                                                                                   
  Delete B                                                                                                                                                                                                                                      
  Delete A
  </code></pre>
  <p>But A has a reference to B, so I would expect the following output:</p>
  <pre><code>Construct B                                                                                                                                                                                                                                   
  Construct A                                                                                                                                                                                                                                   
  Delete A                                                                                                                                                                                                                                      
  Delete B
  </code></pre>
  <p>What am I not getting?</p>