You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tuple.index() could return a more explicit error message #77741
bpo-13349: Non-informative error message in index() and remove() functions
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2018-05-17.16:47:25.763>created_at=<Date2018-05-17.16:20:20.263>labels= ['type-feature', '3.8']
title='tuple.index() could return a more explicit error message'updated_at=<Date2018-05-17.16:47:25.761>user='https://github.com/CyrilRoelandteNovance'
Activity
CyrilRoelandteNovance commentedon May 17, 2018
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 "<stdin>", line 1, in <module> ValueError: tuple.index(x): x not in tupleThe list.index() method has a much better error message:
>>> [].index(1) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: 1 is not in listWe could improve tuple.index() so that its behaviour becomes similar to that of list.index().
serhiy-storchaka commentedon May 17, 2018
This is a duplicate of bpo-13349.