[docs] bug report index method

sdfjsfjaei-thomas at yahoo.de sdfjsfjaei-thomas at yahoo.de
Sat Feb 15 13:28:21 CET 2014


can you please file a bug report about this inconsistency:

for list None is not allowed in the index method, while for str it is.

Also there are 2 different formats for optional paremeters in the help.

>>> ''.index('', 0, None)
97: 0
>>> [].index('', 0, None)
Traceback (most recent call last):
  File "<pyshell#169>", line 1, in <module>
    [].index('', 0, None)
TypeError: slice indices must be integers or None or have an __index__ method
>>> help(''.index)
Help on built-in function index:

    S.index(sub[, start[, end]]) -> int
    Like S.find() but raise ValueError when the substring is not found.

>>> help([].index)
Help on built-in function index:

    L.index(value, [start, [stop]]) -> integer -- return first index of value.
    Raises ValueError if the value is not present.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20140215/b8d577b3/attachment.html>

More information about the docs mailing list