catching exceptions from an except: block

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Mar 7 15:27:33 EST 2007


In <1173292373.770519.158490 at 8g2000cwh.googlegroups.com>, Arnaud Delobelle
wrote:

> # 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.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list