Author veky
Recipients docs@python, veky
Date 2016-09-18.20:50:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1474231832.91.0.157673750963.issue28197@psf.upfronthosting.co.za>
In-reply-to
Content
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. :-)
History
Date User Action Args
2016-09-18 20:50:32vekysetrecipients: + veky, docs@python
2016-09-18 20:50:32vekysetmessageid: <1474231832.91.0.157673750963.issue28197@psf.upfronthosting.co.za>
2016-09-18 20:50:32vekylinkissue28197 messages
2016-09-18 20:50:32vekycreate