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

D-Man dsh8290 at rit.edu
Tue Dec 12 19:22:26 EST 2000


That might be nice sometime.  Java has it.

-D

On Tue, 12 Dec 2000 17:43:39 Niki Spahiev wrote:
 | 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