[New-bugs-announce] [issue39499] ValueError using index on tuple is not showing the tuple value
Oscar
report at bugs.python.org
Thu Jan 30 02:41:48 EST 2020
New submission from Oscar <tuxskar at gmail.com>:
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
----------
messages: 361016
nosy: tuxskar
priority: normal
severity: normal
status: open
title: ValueError using index on tuple is not showing the tuple value
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39499>
_______________________________________
More information about the New-bugs-announce
mailing list