I'm trying to understand the core ideas of Python and I've come across to a nice article that explains passing the parameter reference to an object. For instance;
def add_to_list(list_to_add, value):
  list_to_add.append(value)
will be able to change the original list_to_add parameter while;
def change_list(list_to_add):
  list_to_add = [1, 2, 3, 5]
won't do anything.
I am currently writing a basic linked list print function where it is simply like;
class Node:
  def __init__(self, val, next=None):
    self.val = val
    self.next = next
root = Node(2, Node(3, Node(4, Node(5, Node(6)))))
def print_list(root):
  while root:
    print root.val,
    root = root.next
  print ''
And you've guessed it right. It didn't change the root's value. Now my question is how come this happens. Is it because the python classes are immutable?
 
     
    