[Python-checkins] r67531 - python/trunk/Doc/tutorial/controlflow.rst
georg.brandl
python-checkins at python.org
Thu Dec 4 19:54:06 CET 2008
Author: georg.brandl
Date: Thu Dec 4 19:54:05 2008
New Revision: 67531
Log:
Add reference to enumerate() to indices example.
Modified:
python/trunk/Doc/tutorial/controlflow.rst
Modified: python/trunk/Doc/tutorial/controlflow.rst
==============================================================================
--- python/trunk/Doc/tutorial/controlflow.rst (original)
+++ python/trunk/Doc/tutorial/controlflow.rst Thu Dec 4 19:54:05 2008
@@ -104,8 +104,8 @@
>>> 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 @@
3 little
4 lamb
+In most such cases, however, it is convenient to use the :func:`enumerate`
+function, see :ref:`tut-loopidioms`.
+
.. _tut-break:
More information about the Python-checkins
mailing list