[Python-ideas] Consistent programming error handling idiom

Chris Barker chris.barker at noaa.gov
Fri Apr 8 15:02:16 EDT 2016

On Fri, Apr 8, 2016 at 11:24 AM, <rian at thelig.ht> wrote:

> AssertionError is *always* indicative of a bug
I don't think there is any way to know that -- it all depends on how it's
used. For my part, Assertions are only for testing -- and are actually
turned off in debug mode.

And I think we can say the same thing about ALL Exceptions --even a syntax
error may not be a "stop everything" error in a system that runs
user-written scripts.

I agree with Chris A's point:

Any unhandled Exception is a bug. Simple as that.

Any other interpretation would be a style issue, decided for your

And if you are going to go there, I would do:

if not_a_bug() instead.

Consistent with the principle of good Python code -- only handle the
Exceptions you know to handle.



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160408/6dd9c276/attachment-0001.html>

More information about the Python-ideas mailing list