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

Robert Kern robert.kern at gmail.com
Sun Dec 3 20:05:38 EST 2006


James Stroud wrote:
> Russ wrote:
>> Every Python programmer gets this message occasionally:
>>
>> IndexError: list index out of range
>>
>> The message tells you where the error occurred, but it doesn't tell you
>> what the range and the offending index are. Why does it force you to
>> determine that information for yourself when it could save you a step
>> and just tell you? This seems like a "no-brainer" to me. Am I missing
>> something?
> 
> I think you have a point. I am curious to see how far people are willing 
> to go to defend this omission. It promises to be entertaining.

I'm not sure that anybody is going to defend it as a deliberate omission.
Rather, they (like I) will encourage to OP to submit a patch that fixes the problem.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list