New submission from Raymond Hettinger: Currently, the Sequence ABC doesn't support start and stop arguments for the index() method which limits its usefulness in doing repeated searches (iterating over a target value) and which limits it substitutablity for various concrete sequences such as tuples, lists, strings, bytes, bytearrays, etc.
>>> help(Sequence.index) Help on method index in module _abcoll: index(self, value) unbound _abcoll.Sequence method S.index(value) -> integer -- return first index of value. Raises ValueError if the value is not present. >>> help(list.index) Help on method_descriptor: index(...) L.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present. >>> help(str.index) Help on method_descriptor: index(...) S.index(sub [,start [,end]]) -> int Like S.find() but raise ValueError when the substring is not found. >>> help(tuple.index) Help on method_descriptor: index(...) T.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present. >>> help(bytes.index) Help on method_descriptor: index(...) S.index(sub [,start [,end]]) -> int Like S.find() but raise ValueError when the substring is not found. >>> help(bytearray.index) Help on method_descriptor: index(...) B.index(sub [,start [,end]]) -> int Like B.find() but raise ValueError when the subsection is not found. ---------- assignee: rhettinger components: Library (Lib) messages: 232904 nosy: rhettinger priority: normal severity: normal status: open title: Add start and stop parameters to the Sequence.index() ABC mixin method versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23086> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com