Commit 57cad28c authored by Raymond Hettinger's avatar Raymond Hettinger

Issue 28587: list.index documentation missing start and stop arguments....

Issue 28587:  list.index documentation missing start and stop arguments. (Contributed by Mariatta Wijaya.)
parent 652c1e77
...@@ -60,11 +60,16 @@ objects: ...@@ -60,11 +60,16 @@ objects:
Remove all items from the list. Equivalent to ``del a[:]``. Remove all items from the list. Equivalent to ``del a[:]``.
.. method:: list.index(x) .. method:: list.index(x[, start[, end]])
:noindex: :noindex:
Return the index in the list of the first item whose value is *x*. It is an Return zero-based index in the list of the first item whose value is *x*.
error if there is no such item. Raises a :exc:`ValueError` if there is no such item.
The optional arguments *start* and *end* are interpreted as in the slice
notation and are used to limit the search to a particular subsequence of
*x*. The returned index is computed relative to the beginning of the full
sequence rather than the *start* argument.
.. method:: list.count(x) .. method:: list.count(x)
...@@ -103,6 +108,8 @@ An example that uses most of the list methods:: ...@@ -103,6 +108,8 @@ An example that uses most of the list methods::
[66.25, 333, -1, 333, 1, 1234.5, 333] [66.25, 333, -1, 333, 1, 1234.5, 333]
>>> a.index(333) >>> a.index(333)
1 1
>>> a.index(333, 2) # search for 333 starting at index 2
2
>>> a.remove(333) >>> a.remove(333)
>>> a >>> a
[66.25, -1, 333, 1, 1234.5, 333] [66.25, -1, 333, 1, 1234.5, 333]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment