try... except with unknown error types

John Gordon gordon at panix.com
Fri Aug 19 22:24:38 CEST 2011


In <4e4ec405$0$29994$c3e8da3$5496439d at news.astraweb.com> Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:

> > You can catch all exceptions by catching the base class Exception:

> Except that is nearly always poor advice, because it catches too much: it
> hides bugs in code, as well as things which should be caught.

> You should always catch the absolute minimum you need to catch.

I agree, but it did seem to be exactly what he was asking for.

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list