title: Why does value/pointer assignment behave like this in Python?
body: <p>I had some problem while writing the Join operation on red-black trees. I found what's causing it and tried to simplify it into the following code (because whole blocks of red-black tree code are pretty much unreadable).</p>
  
  <p>So can anyone explain to me why the final line evaluates to False? I think that as the a = b line only assign pointers, c.left should now point to b.</p>
  
  <pre><code>class RedBlackTreeNode:
      def __init__(self, key, color):
          self.key, self.color, self.left, self.right, self.parent = key, color, None, None, None
  a = RedBlackTreeNode(None, False)
  b = RedBlackTreeNode(None, False)
  c = RedBlackTreeNode(1, False)
  c.left = a
  a = b
  print(c.left == b)
  
  &gt;&gt;&gt; False
  </code></pre>