Ignore exceptions

Roger Miller roger.miller at nova-sol.com
Thu Jan 24 17:55:43 EST 2008


On Jan 24, 11:30 am, Jonathan Gardner <jgard... at jonathangardner.net>
wrote:
> ....

> A few sample good uses of try/except blocks:
>
> (1) Do something else if an expected exception occurs.
> ...
> (2) Show a friendly error message when an exception occurs over a
> significant chunk of the program. (Useful for websites and GUI apps.)
> ...

I'd add (3) Clean-up handlers.  These don't actually handle the
problem,
they just free resources, close files, etc. before re-raising the
exception
for someone else to worry about.



More information about the Python-list mailing list