[issue21911] "IndexError: tuple index out of range" should include the requested index and tuple length

Ram Rachum report at bugs.python.org
Fri Jul 4 01:13:33 CEST 2014


Ram Rachum added the comment:

David, as a more generalized solution: Do you think it's possible to make some kind of mechanism in Python that would change the way that an exception is constructed based on whether it's used for control flow or not? I know that it's a bit far-fetched, but if we could figure out a way to do that, it'll free us from having to serve two masters at the same time (one of them being clear error messages, the other being fast times to create an exception.)

That way we could make the exceptions have very helpful messages when a person will see them, but keep them fast when a person won't. It's a shot in the dark but if someone has an idea for how to do it, that'd be cool. Another possibility is to make the -O flag do this switch, though there are problems with that too.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21911>
_______________________________________


More information about the Python-bugs-list mailing list