title: Is it possible to insert extra scopes in python
body: <p>I would like to know if it is possible to inset an extra scope within my code, without defining a function. The problem that I had was as follows: </p>
  
  <pre><code>def func(a, b, c):
     some_var = [a for a in b]
     # do stuff with a
  </code></pre>
  
  <p>My expectation was that a is still the value that I passed to the function, since I expected the other a to be in the scope of the list comprehension (had to search for that bug for ever!). </p>
  
  <p>How can I rewrite it so that the a in the list comprehension is in its own scope? </p>
  
  <p>I would like to have something more elegant than</p>
  
  <pre><code>def func(a, b, c):
     def helper(v): 
         return [a for a in v] 
     some_var = helper(b)
     # do stuff with a
  </code></pre>
  
  <p>In languages where the scope is defined by using <code>{}</code>, you could do stuff like </p>
  
  <pre><code>def func(a, b, c) {
     some_var = null
     {
         some_var = [a for a in b]
     }
     # do stuff with a
  }
  </code></pre>
  
  <p>Is there something similart in Python?</p>