title: Shadows name xyz from outer scope
body: <p>I am using <code>pycharm</code> and it lists out all the errors/warnings associated with the code. While I understand most of them I am not sure of this one "Shadows name xyz from outer scope". There are a few SO posts regarding this: <a href="https://stackoverflow.com/questions/20125172/how-bad-is-shadowing-names-defined-in-outer-scopes">How bad is shadowing names defined in outer scopes?</a> but then they seem to be accessing a global variable. </p>
  
  <p>In my case, my <code>__main__</code> function has a few variable names and then it is calling another function <code>sample_func</code> which uses those variable names again (primarily the loop variable names). I am assuming because I am in a different function, the scope for these variables will be local, however the warning seem to suggest otherwise. </p>
  
  <p>Any thoughts? For your reference here is some code:</p>
  
  <pre><code>def sample_func():
      for x in range(1, 5):  --&gt; shadows name x from outer scope
          print x
  
  if __name__ == "__main__":
      for x in range(1, 5):
          sample_func()
  </code></pre>