MonkeeSage a écrit : > On Mar 7, 4:58 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> except_retry: # the missing(???) keyword you're after > > What is 'except_retry'?
A totally imaginary statement that would do what the OP is looking for. > 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 You don't need to break here since you're returning. > except: > pass > else: > raise ValueError # remove str above to see this -- http://mail.python.org/mailman/listinfo/python-list