On 07/08/2013 01:57 PM, Jim Mooney wrote:
On 8 July 2013 00:12, Steven D'Apranocatching ArithmeticError
further on), please use a custom exception
Well, an Arithmetic Error was better than bubbling up to a totally general
one. I'm not sure how do custom error code. Short example, please ;')
Jim
I think a ValueError might be best. See the description:
http://docs.python.org/2/library/exceptions.html#exceptions.ValueError
exception ValueError
Raised when a built-in operation or function receives an argument that
has the right type but an inappropriate value, and the situation is not
described by a more precise exception such as IndexError.
To make a custom error, first pick another error that's a superset of
what you're doing. Then simply derive your error class from it. As a
minimum:
class TooHugeError (ValueError):
pass
--
DaveA
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor