Namespaces and List Comprehension in python 2.7
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4575698/python-list-comprehension-overriding-value">Python list comprehension overriding value</a>  </p>
</blockquote>



<p>I did some googling around, but no solutions to this issue. It seems like list comprehensions mess with the current namespace, which seems really odd to me.</p>

<pre><code>print i
print [i for i in range(10)]
print i
</code></pre>

<p>The first is an error, the second prints range(10) as expected, and the last line prints 9, the 'last value of i' for the list comprehension. This is completely unexpected to me. What's more, if i was previously defined, it's now been overwritten.</p>

<p>I'm running on Apple's build of Python 2.7 (OS X Lion), if that means anything.</p>
