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
ValueError using index on tuple is not showing the tuple value #83680
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=<Date2020-01-30.09:03:41.752>created_at=<Date2020-01-30.07:41:48.457>labels= ['type-bug', '3.8']
title='ValueError using index on tuple is not showing the tuple value'updated_at=<Date2020-01-30.09:03:41.749>user='https://github.com/tuxskar'
When trying to retrieve the index of an element that is not in a tuple the error message of ValueError is not showing the value looking for but instead a static message tuple.index(x): x not in tuple
>>> b = (1, 2, 3, 4)
>>> b.index(5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: tuple.index(x): x not in tuple
I would expect something like what happen in lists where the element (5 in this case) is showed on the ValueError.
>>> a = [1, 2, 3, 4]
>>> a.index(5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: 5 is not in list
Activity
tuxskar commentedon Jan 30, 2020
When trying to retrieve the index of an element that is not in a tuple the error message of ValueError is not showing the value looking for but instead a static message tuple.index(x): x not in tuple
tirkarthi commentedon Jan 30, 2020
This is a duplicate of bpo-33560. See also bpo-13349 which is the original duplicate.