Issue 33560: tuple.index() could return a more explicit error message (original) (raw)
The tuple.index() method returns an error message that does not allow users to know what element was being looked for inside the tuple:
().index(1) Traceback (most recent call last): File "", line 1, in ValueError: tuple.index(x): x not in tuple
The list.index() method has a much better error message:
[].index(1)
Traceback (most recent call last): File "", line 1, in ValueError: 1 is not in list
We could improve tuple.index() so that its behaviour becomes similar to that of list.index().