[Python-bugs-list] [ python-Bugs-452154 ] globaling a variable twice issues warn

noreply@sourceforge.net noreply@sourceforge.net
Fri, 17 Aug 2001 09:53:09 -0700


Bugs item #452154, was opened at 2001-08-17 09:53
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=452154&group_id=5470

Category: Parser/Compiler
Group: Python 2.1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Andrew Csillag (drew_csillag)
Assigned to: Nobody/Anonymous (nobody)
Summary: globaling a variable twice issues warn

Initial Comment:
The following code generates a warning:

def foo():
    global dammit
    dammit = 5
    global dammit

test.py:1: SyntaxWarning: name 'dammit' is assigned to
before global declaration  def foo():

One would argue that this should still issue a warning,
but the warning it raises is a bit confusing
(especially when the two global statements are 100
lines apart).


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=452154&group_id=5470