[Python-checkins] cpython (merge 3.6 -> default): merge
raymond.hettinger
python-checkins at python.org
Mon Nov 21 18:13:45 EST 2016
https://hg.python.org/cpython/rev/5e289a846d9d
changeset: 105313:5e289a846d9d
parent: 105310:a759fcba1866
parent: 105312:784b6a0bf2bf
user: Raymond Hettinger <python at rcn.com>
date: Mon Nov 21 15:13:38 2016 -0800
summary:
merge
files:
Doc/library/random.rst | 4 ++--
Doc/tutorial/datastructures.rst | 13 ++++++++++---
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/Doc/library/random.rst b/Doc/library/random.rst
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -465,11 +465,11 @@
<http://nbviewer.jupyter.org/url/norvig.com/ipython/Economics.ipynb>`_
a simulation of a marketplace by
`Peter Norvig <http://norvig.com/bio.html>`_ that shows effective
- use of many the tools and distributions provided by this module
+ use of many of the tools and distributions provided by this module
(gauss, uniform, sample, betavariate, choice, triangular, and randrange).
`A Concrete Introduction to Probability (using Python)
<http://nbviewer.jupyter.org/url/norvig.com/ipython/Probability.ipynb>`_
a tutorial by `Peter Norvig <http://norvig.com/bio.html>`_ covering
the basics of probability theory, how to write simulations, and
- performing data analysis using Python.
+ how to perform data analysis using Python.
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -60,11 +60,16 @@
Remove all items from the list. Equivalent to ``del a[:]``.
-.. method:: list.index(x)
+.. method:: list.index(x[, start[, end]])
:noindex:
- Return the index in the list of the first item whose value is *x*. It is an
- error if there is no such item.
+ Return zero-based index in the list of the first item whose value is *x*.
+ 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)
@@ -103,6 +108,8 @@
[66.25, 333, -1, 333, 1, 1234.5, 333]
>>> a.index(333)
1
+ >>> a.index(333, 2) # search for 333 starting at index 2
+ 2
>>> a.remove(333)
>>> a
[66.25, -1, 333, 1, 1234.5, 333]
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list