Exceptions - built-in and home-grown

Sheila King sheila at spamcop.net
Mon Sep 17 19:29:35 CEST 2001

On Mon, 17 Sep 2001 17:42:41 +0100, Dale Strickland-Clark
<dale at riverhall.NOSPAMco.uk> wrote in comp.lang.python in article
<qb8cqtcropq1b9183qq5h04udet5a42mte at 4ax.com>:

:I've had a good root around for information on exceptions but I still
:have some questions:
:Where can I find a list of all the built-in Python exceptions?
:Why would I want to define my own exceptions if suitable Python ones
:Do people do processing in the init routine in their own exceptions?
:Thanks for any insight.

Oh, Dale, you've given me a feeling of deja vu!
For starters, you might want to review this thread

where I asked nearly the same questions.

Also, a list of all python exceptions can be found in the documentation.
Look in the Library Reference, under built-ins. You will find exceptions
listed there.

I recently had an small epiphany, where I found a case where I wrote an
exception that required an init, and thought it was a better example (at
least to me) than any I'd seen so far as to why I might want my own init
routine on an exception class. I can't recall it right now. (Was going
to eventually write it up, but didn't do it right then, and it's been a
few weeks now.) Maybe late tomorrow I will have time to go digging for
that and post it as an example.

Sheila King

More information about the Python-list mailing list