[New-bugs-announce] [issue9997] function named 'top' gets unexpected namespace/scope behaviour

Ivo van der Wijk report at bugs.python.org
Thu Sep 30 14:17:41 CEST 2010


New submission from Ivo van der Wijk <python.org at in.m3r.nl>:

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.

----------
components: Interpreter Core
messages: 117731
nosy: iivvoo
priority: normal
severity: normal
status: open
title: function named 'top' gets unexpected namespace/scope behaviour
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9997>
_______________________________________


More information about the New-bugs-announce mailing list