Returning to 'try' block after catching an exception

Karlo Lozovina _karlo_ at _mosor.net_
Wed May 21 19:33:33 EDT 2008


André <andre.roberge at gmail.com> wrote in
news:a9913f2d-0c1a-4492-bf58-5c78813c4458 at s50g2000hsb.googlegroups.com: 

> How about something like the following (untested)
> 
> done = False
> while not done:
>   try:
>      some_function()
>      done = True
>   except:
>      some_function2()
>      some_function3()

Sure, that works, but I was aiming for something more elegant and Pythonic 
;).


-- 
 _______                                        Karlo Lozovina - Mosor
|   |   |.-----.-----.     web: http://www.mosor.net || ICQ#: 10667163
|       ||  _  |  _  |             Parce mihi domine quia Dalmata sum.
|__|_|__||_____|_____|



More information about the Python-list mailing list