title: List comprehensions leak their loop variable in Python2: how making it be compatible with Python3
body: <p>I just learnt from <a href="https://stackoverflow.com/questions/19848082/why-do-list-comprehensions-write-to-the-loop-variable-but-generators-dont">Why do list comprehensions write to the loop variable, but generators don't?</a> that <strong>List comprehensions also "leak" their loop variable into the surrounding scope</strong>.</p>
  
  <pre><code>Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
  &gt;&gt;&gt; x = 'before'
  &gt;&gt;&gt; a = [x for x in (1, 2, 3)]
  &gt;&gt;&gt; x
  3
  </code></pre>
  
  <p>This bug is fixed in Python3.</p>
  
  <pre><code>Python 3.4.3 (default, Oct 14 2015, 20:28:29) 
  &gt;&gt;&gt; x = 'before'
  &gt;&gt;&gt; a = [x for x in (1, 2, 3)]
  &gt;&gt;&gt; x
  'before'
  </code></pre>
  
  <p>What is the best way to make Python2 be compatible with Python3 at this point?</p>