New submission from Vedran Čačić:

Look at this:

    >>> from import Sequence

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

    >>> issubclass(range, Sequence)

    >>> help(range.index)
        rangeobject.index(value, [start, [stop]]) -> integer -- return index of 
        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 <>
Python-bugs-list mailing list

Reply via email to