[issue30477] tuple.index error message improvement

Raymond Hettinger report at bugs.python.org
Thu May 25 22:22:02 EDT 2017


Raymond Hettinger added the comment:

> Is it a performance worry?

It really depends on what people are doing with their down.  If indexing potentially missing values is common, there will be a performance impact.  

Also, the cost of a __repr__ varies wildly depending on the data (i.e. a collections.Counter instance has an expensive __repr__, decimal objects have computations to runs as well).

>From a user point of view, a repr might be helpful or it might be disasterously lengthy (a webpage, a giant bytearray, a long list of tuples).

Personally, I would rather not do this PR which seems to have the view that the exception is an error condition as opposed to being a normal way to terminate a series of index() calls.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30477>
_______________________________________


More information about the Python-bugs-list mailing list