Does Python do try: except: finally: ?

Irmen de Jong irmen at -NOSPAM-REMOVE-THIS-xs4all.nl
Wed Mar 19 16:29:19 EST 2003


Jerry Seutter wrote:
> Does Python do a block like:
> 
> try:
>     do_something()
> except:
>     do_something_else()
> finally:
>     do_cleanup()
> 
> Python gives me an error when I try to do this and the
> online documentation only gives examples with try-except
> and try-finally blocks. 


Correct, you have to do it like you did in your other code snippet.
Read more in 
http://groups.google.com/groups?threadm=3967d908.363887342%40news.online.no

As I understand it, it has to do with ambiguity.

--Irmen.






More information about the Python-list mailing list