The Samurai Principle

Ian Kelly ian.g.kelly at gmail.com
Wed Sep 8 02:32:48 EDT 2010


On Tue, Sep 7, 2010 at 9:35 PM, Phlip <phlip2005 at gmail.com> wrote:
> Exceptions are very dangerous by themselves, because if you don't trap
> them just right they can cause side-effects.

And returning None on failure is dangerous, because if the programmer
does not take care to handle that case, the program may attempt to
regard it as actual data.  This in turn results in hard-to-track bugs
elsewhere in the program, a fate much worse than an unhandled
exception.  It's better to fail noisily than to fail silently.

> They are worse than GOTO.

This assertion is questionable at best.  Exceptions are structured;
goto is unstructured, giving you much more rope to hang yourself with.



More information about the Python-list mailing list