Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53412

Re: Newbie: use of built-in exceptions

References <kvv7o7$1ek$1@dont-email.me>
Date 2013-09-01 13:26 +0200
Subject Re: Newbie: use of built-in exceptions
From Chris “Kwpolska” Warrick <kwpolska@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.445.1378034792.19984.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Sep 1, 2013 at 1:17 PM, Rui Maciel <rui.maciel@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Newbie: use of built-in exceptions Rui Maciel <rui.maciel@gmail.com> - 2013-09-01 12:17 +0100
  Re: Newbie: use of built-in exceptions Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-09-01 13:26 +0200
    Re: Newbie: use of built-in exceptions Rui Maciel <rui.maciel@gmail.com> - 2013-09-02 18:32 +0100

csiph-web