Checking for an exception

Paul Rubin no.email at nospam.invalid
Sun Jun 25 03:50:50 EDT 2017


Steve D'Aprano <steve+python at pearwood.info> writes:
> 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.)

Maybe I'm missing something but 
   isinstance(obj, Exception)
seems to work.



More information about the Python-list mailing list