[Numpy-discussion] better error message possible?
Tue Jun 5 05:15:56 CDT 2012
On Mon, Jun 4, 2012 at 11:49 PM, Nathaniel Smith <email@example.com> wrote:
> On Mon, Jun 4, 2012 at 10:00 PM, Thouis (Ray) Jones <firstname.lastname@example.org> wrote:
>> On Mon, Jun 4, 2012 at 4:27 PM, Thouis (Ray) Jones <email@example.com> wrote:
>>> I could look into this. There are only ~10 places the code generates
>>> this error, so it should be a pretty minor change.
>> My initial estimate was low, but not overly so. An initial pass at
>> adding index/dimension information to IndexErrors is here:
> Fabulous! I made a few comments there, but also:
>> A typical result:
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> IndexError: index 5 out of bounds in dimension 0
> I would say "for", not "in".
> "index 5" is a bit ambiguous too... people might mis-read it as the
> dimension, like, "the 5th index value I gave"? Not sure how to make it
> unambiguous. Maybe:
> "IndexError: dimension 0 index out of bounds: got 5, size is 3"
IndexError: 5 is out of bounds for dimension 0: must be in [-3, 3).
to be maximally explicit about what values are allowed, and avoid the
More information about the NumPy-Discussion