title: Why reset python global value doesn't take effect
body: <p>Just confused about global value in Python, here are two piece of code</p>
  
  <pre><code>#gl.py
  
  import cli
  
  a = 1    
  print "gl 1: %d %d" % (id(a), a)
  
  
  def reset():
      global a
      a = 7
      print "reset 1: %d %d" % (id(a), a)
  
  
  if __name__ == '__main__':
      cli.handler(reset)
      print "gl 2: %d %d" % (id(a), a)
  </code></pre>
  
  <p>the cli code</p>
  
  <pre><code>#cli.py
  
  def handler(func):
      from gl import a
      print "cli 1: %d %d" % (id(a), a)
      func()
      print "cli 2: %d %d" % (id(a), a)
  </code></pre>
  
  <p>The result of execution is </p>
  
  <pre><code>$ python gl.py
  gl 1: 150847672 1
  gl 1: 150847672 1
  cli 1: 150847672 1
  reset 1: 150847600 7
  cli 2: 150847672 1    #Why value doesn't change
  gl 2: 150847600 7
  </code></pre>
  
  <p>Here I don't understand after "function reset()" execution, the result of global value doesn't change in cli.py(<strong>cli 2: 150847672 1</strong>), but back to gl.py, global value does change!!</p>