are variables local only to try/except blocks?
BarrySearle
searle at ca.ibm.com
Mon Sep 19 10:55:48 EDT 2005
# Is this valid (or is excp local to try/except)?
try:
try:
doSomething1
excp = 0
except:
excp = 1
#endTry
if (_excp_): doSomething1 # is excp defined here?
excp = 0
except:
excp = 1
#endTry
if (excp): doSomething2 # is excp defined here?
# valid, but more verbose (and maybe redundant?)
excp = 0
try:
excp = 0
try:
doSomething1
excp = 0 # reset incase future inner block
except:
excp = 1
#endTry
if (_excp_): doSomething1
excp = 0 # reset incase inner block set excp=1
except:
excp = 1
#endTry
if (excp): doSomething2
I am not so interested in what a particular version of the
Python/Jython interpreter does, but rather what is "right".
Pls "CC" replies to searle at ca.ibm.com (as well as newsgroup)
Barry Searle, searle at ca.ibm.com
More information about the Python-list
mailing list