Which exception has been used? (was: Which exception to use?)

Erik Max Francis max at alcyone.com
Thu Jan 30 22:46:59 EST 2003


Chad Netzer wrote:

> Well, I think Cameron's point is that one can have exceptions that are
> NOT derived from Exception (although it is very bad style; but you may
> not have to be prepared to handle other people's code).  Also, string
> exceptions are still (and at least pychecker wil report that as a
> warning)

I tend to handle it with an except Exception, e: ... followed by an
except: ... where I handle either just sys.exc_type (if that's all I'm
interested in) or the full sys.exc_info().

I think in summary to the questions raised, StandardError is the class
which all internally used Python exception classes are derived. 
Exception is the class from which _all_ (including user-defined)
exception classes should be derived; StandardError, of course, derives
from Exception as well.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ The only way to get rid of a temptation is to yield to it.
\__/ Oscar Wilde
    Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
 A personal guide to Quake III Arena.




More information about the Python-list mailing list