B
Bruno Desthuilliers
MonkeeSage a écrit :
A totally imaginary statement that would do what the OP is looking for.
You don't need to break here since you're returning.
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.