[issue24830] IndexError should (must?) report the index in error!
kedar mhaswade
report at bugs.python.org
Sat Aug 8 16:55:20 CEST 2015
New submission from kedar mhaswade:
I am a n00b Python programmer. So far, I am loving Python! Thank you.
Apologies if this has been already reported. A rudimentary search did not fetch anything and hence I am filing this as an enhancement request. If it has been already reported, please point me in the right direction so that I can stand corrected.
I believe following experience could be improved:
-----------------------------
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> l = []
>>> l[2]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: list index out of range
-----------------------------
if the message would indicate the index in error. This, I believe, is a low-hanging fruit that has several debugging benefits.
I hate to compare things, but I do want to note that Java does better in this regard:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
at Foo.main(Foo.java:5)
----------
messages: 248272
nosy: kedar mhaswade
priority: normal
severity: normal
status: open
title: IndexError should (must?) report the index in error!
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24830>
_______________________________________
More information about the Python-bugs-list
mailing list