What's the right/best way to test whether an object is an exception ahead of
time? (That is, without trying to raise from it.)

I have:

return (isinstance(obj, type) and issubclass(obj, BaseException)
        or isinstance(obj, BaseException))


Any better ideas?



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to