New submission from Vedran Čačić:

Look at this:

    >>> from collections.abc import Sequence

    >>> help(Sequence.index)
    index(self, value, start=0, stop=None)
        S.index(value, [start, [stop]]) -> integer -- return first index of 
value.
        Raises ValueError if the value is not present.

    >>> issubclass(range, Sequence)
    True

    >>> help(range.index)
    index(...)
        rangeobject.index(value, [start, [stop]]) -> integer -- return index of 
value.
        Raise ValueError if the value is not present.

So far, so good. But:

    >>> range(9).index(2, 1, 5)
    TypeError: index() takes exactly one argument (3 given)

Of course it's not essential, but the docs shouldn't lie. And if range _is_ a 
Sequence, then it should have the complete interface of a Sequence. Including 
start and end arguments for .index: they are optional from the point of call, 
not from the point of implementation. :-)

----------
assignee: docs@python
components: Documentation, Library (Lib)
messages: 276908
nosy: docs@python, veky
priority: normal
severity: normal
status: open
title: range.index mismatch with documentation
type: behavior
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28197>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to