summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-12-04 18:54:05 (GMT)
committerGeorg Brandl <georg@python.org>2008-12-04 18:54:05 (GMT)
commit34196c851a92cfcde12532673f5d073e5ee6d6a3 (patch)
tree06adb60487bbc9d3f88e9de84eaeb975ce7dd508 /Doc/tutorial
parent5248103ef910774628639c767b8fbcf88684e013 (diff)
downloadcpython-34196c851a92cfcde12532673f5d073e5ee6d6a3.zip
cpython-34196c851a92cfcde12532673f5d073e5ee6d6a3.tar.gz
cpython-34196c851a92cfcde12532673f5d073e5ee6d6a3.tar.bz2
Add reference to enumerate() to indices example.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/controlflow.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
index 809afc1..f57e9e9 100644
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -104,8 +104,8 @@ increment (even negative; sometimes this is called the 'step')::
>>> range(-10, -100, -30)
[-10, -40, -70]
-To iterate over the indices of a sequence, combine :func:`range` and :func:`len`
-as follows::
+To iterate over the indices of a sequence, you can combine :func:`range` and
+:func:`len` as follows::
>>> a = ['Mary', 'had', 'a', 'little', 'lamb']
>>> for i in range(len(a)):
@@ -117,6 +117,9 @@ as follows::
3 little
4 lamb
+In most such cases, however, it is convenient to use the :func:`enumerate`
+function, see :ref:`tut-loopidioms`.
+
.. _tut-break: