Duncan Booth <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> Catching only the specific exceptions you think you can handle would > be more Pythonic: that way things like sys.exit() will still work > inside some_function. I know, this was just a somewhat poorly example ;). > I prefer a 'for' loop rather than 'while' so I can limit the number of > retries. > > The following may or may not be 'more pythonic', but is something I've > used. It's a factory to generate decorators which will retry the > decorated function. You have to specify the maximum number of retries, > the exceptions which indicate that it is retryable, and an optional > filter function which can try to do fixups or just specify some > additional conditions to be tested. Interesting approach, I think I'll use something like that for avoding infinite loops. Thanks a lot... -- _______ Karlo Lozovina - Mosor | | |.-----.-----. web: http://www.mosor.net || ICQ#: 10667163 | || _ | _ | Parce mihi domine quia Dalmata sum. |__|_|__||_____|_____| -- http://mail.python.org/mailman/listinfo/python-list