Strange compiler warning

Robin Becker robin at jessikat.fsnet.co.uk
Tue Oct 8 04:17:24 EDT 2002


In article <3da227db$1 at news.sentex.net>, Peter Hansen
<peter at engcorp.com> writes
>Robin Becker wrote:
.......
>Basically:
>
>1. the "global" statement applies for the following scope of the 
>function, so you need only one,
>
>2. you can check if it exists simply by trying to reference it,
>
>3. using exceptions is generally better than not.
>
>But what are you really trying to accomplish?
>
>-Peter
>
that will do. I keep thinking that global brings something into scope,
but in fact it's only declarative and doesn't have to exist already.

As for the try except is it really true that

try:
    _dbg
except:
    _dbg = .....

is better than

if not globals().has_key('_dbg'):
    _dbg = .....

-- 
Robin Becker



More information about the Python-list mailing list