summaryrefslogtreecommitdiffstats
path: root/Doc/howto
diff options
context:
space:
mode:
authorChris Jerdonek <chris.jerdonek@gmail.com>2012-10-13 03:28:26 (GMT)
committerChris Jerdonek <chris.jerdonek@gmail.com>2012-10-13 03:28:26 (GMT)
commit006d907afc138a99869481c198eaf39a918df99d (patch)
tree84886b14fe776df5e88dddab5f843c2bf6ae61ca /Doc/howto
parentb548d49f655311835b72e0a27e51d5b73e671c82 (diff)
downloadcpython-006d907afc138a99869481c198eaf39a918df99d.zip
cpython-006d907afc138a99869481c198eaf39a918df99d.tar.gz
cpython-006d907afc138a99869481c198eaf39a918df99d.tar.bz2
Undo changes accidentally reverted in de8787029fe4.
Diffstat (limited to 'Doc/howto')
-rw-r--r--Doc/howto/functional.rst5
1 files changed, 3 insertions, 2 deletions
diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst
index ebbb229..b621a84 100644
--- a/Doc/howto/functional.rst
+++ b/Doc/howto/functional.rst
@@ -292,13 +292,14 @@ ordering of the objects in the dictionary.
Applying :func:`iter` to a dictionary always loops over the keys, but
dictionaries have methods that return other iterators. If you want to iterate
over values or key/value pairs, you can explicitly call the
-:meth:`~dict.values` or :meth:`~dict.items` methods to get an appropriate iterator.
+:meth:`~dict.values` or :meth:`~dict.items` methods to get an appropriate
+iterator.
The :func:`dict` constructor can accept an iterator that returns a finite stream
of ``(key, value)`` tuples:
>>> L = [('Italy', 'Rome'), ('France', 'Paris'), ('US', 'Washington DC')]
- >>> dict(iter(L))
+ >>> dict(iter(L)) #doctest: +SKIP
{'Italy': 'Rome', 'US': 'Washington DC', 'France': 'Paris'}
Files also support iteration by calling the :meth:`~io.TextIOBase.readline`