title: Have Python 2.7 functions remember value and not reference? Closure Weirdness
body: <p>I'm trying to return from a function a list of functions, each of which uses variables from the outside scope. This isn't working. Here's an example which demonstrates what's happening:</p>
  
  <pre><code>a = []
  for i in range(10):
      a.append(lambda x: x+i)
  a[1](1) # returns 10, where it seems it should return 2
  </code></pre>
  
  <p>Why is this happening, and how can I get around it in python 2.7 ?</p>