[Python-checkins] cpython (2.7): Reorder the entries to put the type specific technique last.
raymond.hettinger
python-checkins at python.org
Tue Apr 24 06:27:07 CEST 2012
http://hg.python.org/cpython/rev/e2a3260f1718
changeset: 76513:e2a3260f1718
branch: 2.7
parent: 76480:db26c4daecbb
user: Raymond Hettinger <python at rcn.com>
date: Mon Apr 23 21:24:15 2012 -0700
summary:
Reorder the entries to put the type specific technique last.
files:
Doc/tutorial/datastructures.rst | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -577,16 +577,6 @@
Looping Techniques
==================
-When looping through dictionaries, the key and corresponding value can be
-retrieved at the same time using the :meth:`iteritems` method. ::
-
- >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
- >>> for k, v in knights.iteritems():
- ... print k, v
- ...
- gallahad the pure
- robin the brave
-
When looping through a sequence, the position index and corresponding value can
be retrieved at the same time using the :func:`enumerate` function. ::
@@ -633,6 +623,16 @@
orange
pear
+When looping through dictionaries, the key and corresponding value can be
+retrieved at the same time using the :meth:`iteritems` method. ::
+
+ >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}
+ >>> for k, v in knights.iteritems():
+ ... print k, v
+ ...
+ gallahad the pure
+ robin the brave
+
.. _tut-conditions:
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list