title: Not able to get how reference are work in python
body: <pre><code>a = binaryTree()
  a.insert(3)
  a.insert(2)
  currentNode = a.root
  a.inOrderTraversal()
  currentNode = currentNode.left
  currentNode.data = 9
  # currentNode = None
  # currentNode.left = None
  a.inOrderTraversal()
  </code></pre>
  <p>You can see in above code when I put <code>currentNode.data = 9</code> and check the <code>inOrderTraversal</code> of the tree it was showing the result 9, 3 which was working as expected but when I comment out <code>currentNode.data = 9</code> and assign <code>currentData = None</code> then it will show 2, 3 which was assign earlier. Why did currentNode not become None ?</p>
  <p>Full code:</p>
  <pre><code>class node:
    def __init__(this,data=None):
      this.left = None
      this.right = None
      this.data = data
  
  class binaryTree:
    def __init__(this):
      this.root = None
  
    def insert(this,data):
      newNode = node(data)
      if(this.root == None):
        this.root = newNode
      else:
        currentNode = this.root
        while(True):
          if(data &gt; currentNode.data):
            if(currentNode.right == None):
              currentNode.right = newNode
              break
            else:
              currentNode = currentNode.right
          else:
            if(currentNode.left == None):
              currentNode.left = newNode
              break
            else:
              currentNode = currentNode.left
  
    def inOrderTraversal(this):
      currentNode = this.root
      if(currentNode == None):
        return &quot;Tree is empty&quot;
      stack = []
      stack.append(currentNode)
      currentNode = currentNode.left
      while(True):
        if(currentNode == None and (len(stack) &lt; 1)):
          break
        elif(currentNode == None and (len(stack) &gt; 0)):
          node = stack.pop()
          print(node.data)
          currentNode = node.right
        else:
          stack.append(currentNode)
          currentNode = currentNode.left
  
  a = binaryTree()
  a.insert(3)
  a.insert(2)
  currentNode = a.root
  # a.inOrderTraversal()
  currentNode = currentNode.left
  # currentNode.data = 9
  currentNode = None
  # currentNode.left = None
  a.inOrderTraversal()
  # print(&quot;check&quot;)
  </code></pre>