[Numpy-discussion] better error message possible?
Chris Barker
chris.barker at noaa.gov
Fri Jun 1 12:34:36 EDT 2012
>> On Fri, Jun 1, 2012 at 10:46 AM, Chris Withers <chris at simplistix.co.uk>
>> > 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 :-).
That would be nice, but to be fair, python itself doesn't do it either:
>>> l = range(10)
>>> l[12]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
Though Python's standard error messages are lacking in a lot of places...
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the NumPy-Discussion
mailing list