diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2009-09-12 19:50:05 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2009-09-12 19:50:05 (GMT) |
commit | 306afd30a08b4f3732354d6fad270a88854ea604 (patch) | |
tree | 79db7d2f04cfff986468e6150235d70014a15ea8 /Doc | |
parent | c32640de2ea26e81d3000cf2d5d6d4e8344118e5 (diff) | |
download | cpython-306afd30a08b4f3732354d6fad270a88854ea604.zip cpython-306afd30a08b4f3732354d6fad270a88854ea604.tar.gz cpython-306afd30a08b4f3732354d6fad270a88854ea604.tar.bz2 |
Merged revisions 74748 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r74748 | ezio.melotti | 2009-09-12 04:52:05 +0300 (Sat, 12 Sep 2009) | 1 line
d.items() -> list(d.items()) in the examples
........
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/collections.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 1d82364..d7907b0 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -538,7 +538,7 @@ sequence of key-value pairs into a dictionary of lists: >>> for k, v in s: ... d[k].append(v) ... - >>> d.items() + >>> list(d.items()) [('blue', [2, 4]), ('red', [1]), ('yellow', [1, 3])] When each key is encountered for the first time, it is not already in the @@ -553,7 +553,7 @@ simpler and faster than an equivalent technique using :meth:`dict.setdefault`: >>> for k, v in s: ... d.setdefault(k, []).append(v) ... - >>> d.items() + >>> list(d.items()) [('blue', [2, 4]), ('red', [1]), ('yellow', [1, 3])] Setting the :attr:`default_factory` to :class:`int` makes the @@ -565,7 +565,7 @@ languages): >>> for k in s: ... d[k] += 1 ... - >>> d.items() + >>> list(d.items()) [('i', 4), ('p', 2), ('s', 4), ('m', 1)] When a letter is first encountered, it is missing from the mapping, so the @@ -592,7 +592,7 @@ Setting the :attr:`default_factory` to :class:`set` makes the >>> for k, v in s: ... d[k].add(v) ... - >>> d.items() + >>> list(d.items()) [('blue', set([2, 4])), ('red', set([1, 3]))] |