]> granicus.if.org Git - python/commitdiff
Reorder the entries to put the type specific technique last.
authorRaymond Hettinger <python@rcn.com>
Tue, 24 Apr 2012 04:24:15 +0000 (21:24 -0700)
committerRaymond Hettinger <python@rcn.com>
Tue, 24 Apr 2012 04:24:15 +0000 (21:24 -0700)
Doc/tutorial/datastructures.rst

index 489a336a83d36e2b08439742067e64469109bdf6..0240e616b76623d4bf8380dcfae223aded698bb4 100644 (file)
@@ -577,16 +577,6 @@ keyword arguments::
 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 @@ returns a new sorted list while leaving the source unaltered. ::
    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: