Why not just show the out-of-range index?

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 4 12:36:30 EST 2006


Russ schrieb:
> I love Python, but every time I get an out-of-range error message, I
> wonder why it didn't just tell me what the out-of-range index was and
> what the allowable range was. Certainly that information must be
> available to the exception handler, or how would it know that it is out
> of range?

Yes, that is true. The information is readily available.

It's not true that it is "trivial" to fix, though: for every fix, there
ought to be a new test case also, and you have to run the test suite.
Depending on how fast a developer is, it may take between 30min and
1hour to get a fix implemented (for the list case alone, not counting
all the other sequences).

Even though I could fix it, I don't feel tempted to do so: I never had
this problem; in most cases of IndexError, it was very clear what the
problem was so I didn't need the additional information.

Regards,
Martin



More information about the Python-list mailing list