This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: function named 'top' gets unexpected namespace/scope behaviour
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Jeremy.Hylton, benjamin.peterson, dan.uznanski, iivvoo, jerith
Priority: normal Keywords:

Created on 2010-09-30 12:17 by iivvoo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg117731 - (view) Author: Ivo van der Wijk (iivvoo) Date: 2010-09-30 12:17
This issue is also discussed on Stackoverflow: http://stackoverflow.com/q/3828611/320057

The following code

def top(deck):
    pass

def b():
    global deck

results in the error "SyntaxError: name 'deck' is local and global" (slightly different for 3.x). This is strange by itself, and is caused by special namespace behaviour attached to the "top" symbol. Renaming the "top" function actually solves the error!

More technical details are in the stackoverflow link above.
msg117732 - (view) Author: Jeremy Hylton (Jeremy.Hylton) (Python committer) Date: 2010-09-30 13:20
Let me fix that.
msg118853 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-10-16 03:46
r85562.
History
Date User Action Args
2022-04-11 14:57:07adminsetgithub: 54206
2010-10-16 03:46:06benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg118853

resolution: fixed
2010-10-01 18:24:06jerithsetnosy: + jerith
2010-09-30 18:00:37dan.uznanskisetnosy: + dan.uznanski
2010-09-30 13:20:32Jeremy.Hyltonsetnosy: + Jeremy.Hylton
messages: + msg117732
2010-09-30 12:17:40iivvoocreate