Which exception to use?

Michael Hudson mwh at python.net
Wed Jan 29 13:27:30 CET 2003


Chad Netzer <cnetzer at mail.arc.nasa.gov> writes:

> I do things like this for some library functions that I create (I 
> welcome discussion about whether it is a good approach)
> 
> class ArgumentError( Exception ):
>     pass

This *is* a good approach (IMHO), but you should consider deriving
your exceptions from StandardError instead (I rarely remember to do
this, either).

Cheers,
M.

-- 
 All parts should go together without forcing. You must remember that
 the parts you are  reassembling were disassembled by you.  Therefore,
 if you can't get them together again, there must be a reason. By all
 means, do not use a hammer.           -- IBM maintenance manual, 1925




More information about the Python-list mailing list