DangerousExceptions (was Re[2]: [Q] Are Exceptions used that much in practice?)

Niki Spahiev spahievi at vega.bg
Tue Dec 12 17:43:39 EST 2000


12.12.2000, 21:34:08, Rainer Deyke wrote:

RD> "Alex Martelli" <aleaxit at yahoo.com> wrote in message
RD> news:914mfd02ibt at news2.newsguy.com...
>> (Some might prefer a wider 'except: return 0' clause, but
>> most often it's better to be specific in catching exceptions).

RD> I would go further and say that 'except: return 0' should never be used,
RD> since it would catch and ignore MemoryError, KeyboardInterrupt, SystemExit,
RD> ComputerExplodingError, or any number of other exceptions that are totally
RD> unrelated to the issue at hand and require careful handling and/or program
RD> termination.

While at this i always wished that Exception has two subclasses:
"NormalException" and "DangerousException" so one can use

except NormalException: return 0

and not worry about  MemoryError, KeyboardInterrupt, SystemExit,
 ComputerExplodingError :) being improperly handled.


-- 
Best regards,
 Niki Spahiev






More information about the Python-list mailing list