catching exceptions from an except: block
MonkeeSage
MonkeeSage at gmail.com
Wed Mar 7 21:02:44 EST 2007
On Mar 7, 4:58 pm, Bruno Desthuilliers
<bdesth.quelquech... at free.quelquepart.fr> wrote:
> except_retry: # the missing(???) keyword you're after
What is 'except_retry'?
To the OP, with the loop and the callables you could also break out of
the loop when the condition is met and use the else condition to raise
the exception.
def test(arg):
for f in int, float, str, hex:
try:
return f(arg)
break # breaks on f==str
except:
pass
else:
raise ValueError # remove str above to see this
print test('^&%')
Regards,
Jordan
More information about the Python-list
mailing list