Paul Anton Letnes <paul.anton.letnes <at> gmail.com> writes:

> I would prefer:
> IndexError: index 3 is out of bounds for axis 0: [-3,2]
> as I find the 3) notation a bit weird - after all, indices are not floats, so 
2.999 or 2.3 doesn't make sense as
> an index.
> 
> An alternative is to not refer to negative indices and say
> IndexError: index 3 is out of bounds for axis 0, shape was: (3,)
> (print more axes when the number of axes is higher.)
> 

+1 for the latter suggestion - if the array shape is available it's a great 
help in debugging the error.

An alternative wording could be:

IndexError: Index 3 is out of bounds for axis 0 of an array of shape (3,2,4)

-Dave

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to