[Python-ideas] Consistent programming error handling idiom

Chris Angelico rosuav at gmail.com
Fri Apr 8 14:28:47 EDT 2016


On Sat, Apr 9, 2016 at 4:24 AM,  <rian at thelig.ht> wrote:
> Python may be able to do something here. One possible thing is a new
> exception hierarchy, there may be other solutions. This may be sufficient
> but I doubt it:
>
>     def is_a_bug(e):
>         return isinstance(e, AssertionError)
>
> The reason I am polling python-ideas is that I can't be the only one who has
> ever encountered this deficiency in Python.

How about this:

def is_a_bug(e):
    return True

ANY uncaught exception is a bug. Any caught exception is not a bug.

ChrisA


More information about the Python-ideas mailing list