[Python-checkins] cpython (3.2): zip() returns an iterator, make a list() of it; thanks to Martin from docs@

sandro.tosi python-checkins at python.org
Sun Aug 12 10:25:22 CEST 2012


http://hg.python.org/cpython/rev/233673503217
changeset:   78512:233673503217
branch:      3.2
parent:      78507:3654c711019a
user:        Sandro Tosi <sandro.tosi at gmail.com>
date:        Sun Aug 12 10:24:50 2012 +0200
summary:
  zip() returns an iterator, make a list() of it; thanks to Martin from docs@

files:
  Doc/tutorial/datastructures.rst |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -292,7 +292,7 @@
 In the real world, you should prefer built-in functions to complex flow statements.
 The :func:`zip` function would do a great job for this use case::
 
-   >>> zip(*matrix)
+   >>> list(zip(*matrix))
    [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]
 
 See :ref:`tut-unpacking-arguments` for details on the asterisk in this line.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list