title: Python: Append lambda functions to list
body: <p>Can anyone do sanity check?</p>
  
  <p>I'm trying to make functions in for-loop.
  The point I can't understand is summarized in the following code:</p>
  
  <pre><code>f_list = []
  for i in range(10):
      f = lambda j : i
      f_list.append(f)
  </code></pre>
  
  <p>Then,</p>
  
  <pre><code>&gt;&gt;&gt; f_list[0](0)
  9                  #I hope this is 0.
  &gt;&gt;&gt; f_list[1](0)
  9                  #I hope this is 1.
  </code></pre>
  
  <p>Why is this happen??</p>