[CentralOH] Missing Exceptions?: Empty except to be avoided?

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Tue Dec 13 23:01:56 CET 2011


On Tue, 13 Dec 2011 15:40:50 -0500, Eric Floehr <eric at intellovations.com> wrote:

> > How does one determine what all the relevant exceptions are?
> > How does one conclude that the the list of exceptions is complete?

> ... there is no way to know other
> than via method documentation or code inspection.

Ugg. 

> ... a raw except which acts as a wildcard and catch all
> exceptions not previously trapped, like:
> 
> try:
>     ...
> except:
>     print "Unexpected error:", sys.exc_info()[0]
>     raise # (or sys.exit(1) or whatever)

I thought that empty except clauses were usually to be 
avoided. For example, because they might catch exceptions 
unrelated to the try code, such as a keyboard interrupt.[1]

[1] p885 of Learning Python 4th ed. 2011-05-20 printing



More information about the CentralOH mailing list