title: strange python behaviour with mixing globals/parameters and function named 'top'
body: <p>The following code (not directly in an interpreter, but execute as file)</p>
  
  <pre><code>def top(deck):
      pass
  
  def b():
      global deck
  </code></pre>
  
  <p>produces the error</p>
  
  <pre><code>SyntaxError: name 'deck' is local and global
  </code></pre>
  
  <p>on python2.6.4 and</p>
  
  <pre><code>SyntaxError: name 'deck' is parameter and global
  </code></pre>
  
  <p>on python 3.1</p>
  
  <p>python2.4 seems to accept this code, so does the 2.6.4 interactive interpreter.</p>
  
  <p>This is already odd; why is 'deck' conflicting if it's a global in one method and a parameter in the other? </p>
  
  <p>But it gets weirder. Rename 'top' to basically anything else, and the problem disappears.</p>
  
  <p>Can someone explain this behaviour? I feel like I'm missing something very obvious here. Is the name 'top' somehow affecting certain scoping internals?</p>
  
  <p><strong>Update</strong></p>
  
  <p>This indeed appears to be a bug in the python core. <a href="http://bugs.python.org/issue9997" rel="noreferrer">I have filed a bug report</a>. </p>