This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author petri.lehtinen
Recipients ezio.melotti, petri.lehtinen
Date 2011-11-07.10:08:51
SpamBayes Score 8.525464e-09
Marked as misclassified No
Message-id <1320660532.38.0.380013415211.issue13349@psf.upfronthosting.co.za>
In-reply-to
Content
The good thing about this is ease of debugging. You can see which is the offending value that was not found.

On the other hand, the repr of a value might be very long:

>>> [].index(list(range(1000)))
ValueError: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...
(many lines of numbers)
997, 998, 999] is not in list

Also, all values don't have a very informal repr:

>>> class Foo: pass
...
>>> [].index(Foo())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: <__main__.Foo object at 0xb736f92c> is not in list
History
Date User Action Args
2011-11-07 10:08:52petri.lehtinensetrecipients: + petri.lehtinen, ezio.melotti
2011-11-07 10:08:52petri.lehtinensetmessageid: <1320660532.38.0.380013415211.issue13349@psf.upfronthosting.co.za>
2011-11-07 10:08:51petri.lehtinenlinkissue13349 messages
2011-11-07 10:08:51petri.lehtinencreate