[Numpy-discussion] better error message possible?
Charles R Harris
charlesr.harris at gmail.com
Sun Jun 3 16:00:56 EDT 2012
On Fri, Jun 1, 2012 at 10:56 AM, Chris Withers <chris at simplistix.co.uk>wrote:
> On 01/06/2012 16:39, Benjamin Root wrote:
> >
> >
> > > >>> import numpy
> > > >>> numpy.zeros(10)[-123]
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in <module>
> > > IndexError: index out of bounds
> > >
> > > ...could say this:
> > >
> > > >>> numpy.zeros(10)[-123]
> > > Traceback (most recent call last):
> > > File "<stdin>", line 1, in <module>
> > > IndexError: -123 is out of bounds
> >
> > Only that no-one has implemented it, I guess. If you want to then
> > that'd be cool :-).
> >
> > To be generally useful for debugging, it would probably be good for
> > the error message to also mention which dimension is involved, and/or
> > the actual size of the array in that dimension. You can also get such
> > error messages from expressions like 'arr[i, j, k]', after all, where
> > it's even less obvious what went wrong.
> >
> > -- Nathaniel
> >
> >
> > +1, please!
>
> Indeed, sadly I'm not a C developer. It's a pet bugbear of mine that
> Python's built-in exceptions often tell you what went wrong but not what
> data caused the error, even when it's easily to hand when raising the
> exception.
>
> Where's the right place to raise an issue that a numpy developer can
> hopefully make the (I suspect) simple change to get this behaviour?
>
>
Hmm, how about I enable github issues for the numpy repository? It looks
like we are headed that way and maybe now is a good time to get started.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120603/83e3373e/attachment.html>
More information about the NumPy-Discussion
mailing list