Serhiy Storchaka added the comment:
I concur with Raymond.
But shouldn't we change error messages that contains the repr of not found
value? Affected collections are list, deque and range.
>>> [].index('spam')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: 'spam' is not in list
>>> import collections
>>> collections.deque().index('spam')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: 'spam' is not in deque
range.index() raises different error messages depending on the type of the
value:
>>> range(10).index('spam')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: sequence.index(x): x not in sequence
>>> range(10).index(42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: 42 is not in range
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13349>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com