Deriving from Exception (was Re: reducing if statements and error handling)

Aahz Maruch aahz at panix.com
Fri Aug 24 12:01:12 EDT 2001


In article <3b8263ad$1_1 at news5.uncensored-news.com>,
Doug Fort  <doug.fort at verizon.net> wrote:
>
>With regards to number 2), I find that when I use exceptions judiciously I 
>don't need to have functions return a 'success' value. You can define 
>custom exceptions easily. It's a good idea to derive them from Exception, 
>but not absolutely neccessary.

Yes, it is absolutely necessary.  It's not currently enforced, but Guido
has declared that it will be at some point in the future.  New code
should *always* derive from Exception (or one of its subclasses).
-- 
                      --- Aahz  <*>  (Copyright 2001 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"I now regard a fact as a hypothesis that people don't bother to argue
about anymore."  --John Burn, quoted in Lawrence Wright's _Twins_



More information about the Python-list mailing list