title: Python global/local variables
body: <p>Why does this code work:</p>
  
  <pre><code>var = 0
  
  def func(num):
      print num
      var = 1
      if num != 0:
          func(num-1)
  
  func(10)
  </code></pre>
  
  <p>but this one gives a "local variable 'var' referenced before assignment" error:</p>
  
  <pre><code>var = 0
  
  def func(num):
      print num
      var = var
      if num != 0:
          func(num-1)
  
  func(10)
  </code></pre>