On Sat, Oct 29, 2016 at 8:36 AM, Sven R. Kunze <srku...@mail.de> wrote:
> Another issue I encounter regularly are things like:
>
>>>> func(mylist[i], mylist2[j])
>
> IndexError: list index out of range
>
>
> So, which are the list and index that cause the error?

+1. Showing the list's contents might be problematic, but it could
show the valid indices - if the lists are different lengths, it would
tell you which is which.

IndexError: list index 5 is out of range -4..3.

Added bonus: Someone who doesn't know that negative indices are valid
will get a cool hint.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to