Best practise hierarchy for user-defined exceptions

Scott David Daniels Scott.Daniels at Acm.Org
Tue Nov 18 18:15:21 EST 2008


Nick Craig-Wood wrote:
> Slaunger <Slaunger at gmail.com> wrote:
>> ....  I will not notice that it was an unanticpated condition
>>  in my own code, which caused the ValueError to be raised.
>>  If I had just inherited from MyError, it would fall through....
> 
> I'd say if the above code worries you, then MyParseError isn't a
> ValueError and you shouldn't inherit from ValueError.

Just from the name, I'd look into making MyParseError inherit from
SyntaxError.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list