An `IndexError` indicates that an out of bounds or invalid index was used.
Python
The IndexError
is raised only when the index is out of bounds:
>>> a = [1, 2, 3, 4, 5]
>>> a[10]
IndexError Traceback (most recent call last)
[...]
IndexError: list index out of range
However invalid entries will raise a typeerror.
Ruby
See their IndexError
documentation for an example which raises an IndexError.