Strange compiler warning

Robin Becker robin at jessikat.fsnet.co.uk
Mon Oct 7 19:52:43 CEST 2002


with 2.2.1 I get the message

SyntaxWarning: name '_dbg' is assigned to before global declaration with
the following code, but things seem to be working, so is the compiler
wrong or too lazy to see the globals on all paths? How should one do
this sort of on the fly local debugging? 

......
    if not globals().has_key('_dbg'):
        global _dbg
        _dbg=open('/tmp/_dbg.txt','w')
    else:
        global _dbg
    print >>_dbg,'=======================\n' + text
-- 
Robin Becker



More information about the Python-list mailing list