On Mon, Jun 4, 2012 at 11:49 PM, Nathaniel Smith <n...@pobox.com> wrote: > On Mon, Jun 4, 2012 at 10:00 PM, Thouis (Ray) Jones <tho...@gmail.com> wrote: >> On Mon, Jun 4, 2012 at 4:27 PM, Thouis (Ray) Jones <tho...@gmail.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: >> https://github.com/thouis/numpy/tree/index_error_info > > Fabulous! I made a few comments there, but also: > >> A typical result: >> >>>>> numpy.zeros(3)[5] >> 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" > > ?
How about: 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 "index" confusion. Ray Jones _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion