I suspect this is historical but nothing in the docs explains it.
demo = 'zero', 'one', 'two'
a = demo.index('three')
will raise a ValueError.
dict()['three'] and demo[100]
raises KeyError, IndexError
I find IndexError more logical for list.index failing. You failed to find the index of the requested key.
Am I right? And they can't change it after all this time? Or is ValueError the right one for the failing list.index
I also notice LookupError has parents: KeyError, IndexError
but not AttributeError which is effectively a keyError from dict