On 29/11/2016 20:09, Terry Reedy wrote:
On 11/29/2016 11:32 AM, Rob Cliffe wrote:
On 29/11/2016 04:58, victor rajewski wrote:
Traceback (most recent call last):
File "foo.py", line 2, in <module>
l[10]=14
IndexError: list assignment index out of range
A better message might be:
You tried to use l[10] when l is only 4 elements long. You can add items to l using l.append(value), or check your index value to make sure that's really the position you wanted to access.
It would make sense to me to upgrade this particular error message to IndexError: list assignment index 10 out of range 0 to 3 if it can be done without too much difficulty or overhead. (An empty list, and perhaps one with only 1 element, would be special cases.) Come to think of it, is the word "assignment" needed?
It would help if the line were "l1[10] = 2 * l2[13] + 3".
You're right of course; "assignment" IS meaningful; I missed it.
[][0] Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: list index out of range