[issue44166] Make IndexError messages for list more informative
Raymond Hettinger
report at bugs.python.org
Sun Dec 5 16:31:17 EST 2021
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
Here's another way to think of it:
The call s[i] raising an IndexError isn't a numerical error, it is a conceptual error. Knowing that i==15 and len(s)==10 doesn't usually help resolve the problem. The fix typically isn't replacing s[i] with s[i - 5]. Usually the issue is usually deeper than that.
Note, this is different than KeyError where misspellings are common and where the fix can be indicated by knowing the key: d['missteak'] -> d['mistake'].
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44166>
_______________________________________
More information about the Python-bugs-list
mailing list