[Tutor] Most pythonic input validation
davea at ieee.org
Sat Oct 17 04:41:45 CEST 2009
Kent Johnson wrote:
>> Is this the way to define my own error and to use it:
>> class MyValueError(Exception):
>> define initialization and printing
> You usually don't need to define anything extra, the Exception methods are fine.
I think there could be confusion over what you meant was unnecessary.
It's a "good thing" to define MyValueError(Exception), but it's usually
unnecessary to give it a body, because the methods it inherits from
Exception are usually just fine.
More information about the Tutor