Deriving from Exception (was Re: reducing if statements and error handling)
Doug Fort
doug.fort at verizon.net
Fri Aug 24 13:31:24 EDT 2001
Aahz Maruch wrote:
> 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).
Thanks, I didn't know it was going to be enforced, but I fully endorse it.
(Now I have to root out the strings I was throwing in the early days)
--
Doug Fort <dougfort at dougfort.net>
http://www.dougfort.net
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Seven Servers In California And Texas - The Worlds Uncensored News Source
More information about the Python-list
mailing list