exceptions considered harmful

Roy Smith roy at panix.com
Fri Jun 17 20:00:39 EDT 2005


"H. S. Lahman" <h.lahman at verizon.net> wrote:
> >     Never throw an exception. And if someone throws one at you,
> >     catch it immediately and don't pass it on.
> 
> IMO, this is generally fine advice.  Languages provide exception 
> handlers so that applications have a chance to respond gracefully when 
> the software is in an unstable state.  IOW, you should never see an 
> exception unless the software is seriously broken.  A corollary is that 
> if the software is corrupted, then even processing the exception becomes 
> high risk.  So one should do as little as possible when processing 
> exceptions.  (Some languages provide a degree of bullet proofing, but 
> that just make the exception handling facility too expensive to use for 
> routine processing.)

This sounds like a very C++ view of the world.  In Python, for example, 
exceptions are much more light weight and perfectly routine.



More information about the Python-list mailing list