try... except with unknown error types
no.email at nospam.invalid
Sat Aug 20 21:18:25 CEST 2011
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.
But there's no way to know what that minimum is. Python libraries throw
all sorts of exceptions that their documentation doesn't mention.
Java's checked exceptions are obnoxious but they do have their
More information about the Python-list