>>5378
https://docs.python.org/3/library/stdtypes.html#index-19
"""8. index raises ValueError when x is not found in s. Not all implementations support passing the additional arguments i and j. These arguments allow efficient searching of subsections of the sequence. Passing the extra arguments is roughly equivalent to using s[i:j].index(x), only without copying any data and with the returned index being relative to the start of the sequence rather than the start of the slice."""
While this is poor design, it is documented behavior. The workaround is:
>>> import operator
>>> import functools
>>> def seqindex (seq, item):
... return next (
... map (operator.itemgetter (0),
... filter (operator.itemgetter (1),
... enumerate (
... map (functools.partial (operator.eq, item),
... seq)))), -1)
...
>>> seqindex ((1, 2, 3), 3)
2
>>> seqindex ((1, 2, 3), 4)
-1
>>>