[Numpy-discussion] better error message possible?

Benjamin Root ben.root@ou....
Fri Jun 1 10:39:34 CDT 2012


On Fri, Jun 1, 2012 at 9:14 AM, Nathaniel Smith <njs@pobox.com> wrote:

> On Fri, Jun 1, 2012 at 10:46 AM, Chris Withers <chris@simplistix.co.uk>
> wrote:
> > Hi All,
> >
> > Any reason why this:
> >
> >  >>> 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!

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120601/9d064278/attachment.html 


More information about the NumPy-Discussion mailing list