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


Groups > comp.lang.python > #107398 > unrolled thread

Re: How much sanity checking is required for function inputs?

Started byStephen Hansen <me@ixokai.io>
First post2016-04-19 23:17 -0700
Last post2016-04-19 23:17 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How much sanity checking is required for function inputs? Stephen Hansen <me@ixokai.io> - 2016-04-19 23:17 -0700

#107398 — Re: How much sanity checking is required for function inputs?

FromStephen Hansen <me@ixokai.io>
Date2016-04-19 23:17 -0700
SubjectRe: How much sanity checking is required for function inputs?
Message-ID<mailman.17.1461133060.12923.python-list@python.org>
On Tue, Apr 19, 2016, at 11:09 PM, Ethan Furman wrote:
> On 04/19/2016 10:51 PM, Stephen Hansen wrote:
> > I use 1) more to be less 'nicer' and more, er, 'more specific'. Since I
> > don't like exceptions to rise to the user level where niceness is
> > needed.
> 
> Yeah, that's a better phrasing for (1); I meant more appropriate or 
> informative, such as swapping an internal error (such as KeyError) for a 
> more meaningful FieldNotFound error (or whatever) -- largely library 
> code concerns.

Yeah, and what the OP is doing is going the exact opposite-- from a
more-specific exception (KeyError) to a more generic one (Exception).

To me that's (usually) an anti-pattern. 

--S

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web