catching exceptions from an except: block

Marc 'BlackJack' Rintsch bj_666 at
Wed Mar 7 21:27:33 CET 2007

In <1173292373.770519.158490 at>, Arnaud Delobelle

> # This one only works because a,b,c are functions
> # Moreover it seems like an abuse of a loop construct to me
> def rolled_first(x):
>     for f in a, b, c:
>         try:
>             return f(x)
>         except:
>             continue
>     raise CantDoIt
> ----------

Why do you think this is an abuse?  I think it's a perfectly valid use of
a loop.

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list