Newbie: use of built-in exceptions

Chris “Kwpolska” Warrick kwpolska at gmail.com
Sun Sep 1 07:26:30 EDT 2013


On Sun, Sep 1, 2013 at 1:17 PM, Rui Maciel <rui.maciel at gmail.com> wrote:
> Are there any guidelines on the use (and abuse) of Python's built-in exceptions, telling where
> it's ok to raise them and where it's preferable to define custom exceptions instead?

There are no rules.  You should use common sense instead: if the
exception fits your needs (eg. ValueError when incorrect output
occurs) then use it.

-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense



More information about the Python-list mailing list