classification
Title: zip() function example in tutorial
Type: Stage:
Components: Documentation Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, jsizelove
Priority: normal Keywords: patch

Created on 2008-08-08 00:11 by jsizelove, last changed 2008-08-08 06:44 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
datastructures.diff jsizelove, 2008-08-08 00:11
Messages (2)
msg70871 - (view) Author: Jim Sizelove (jsizelove) Date: 2008-08-08 00:11
The zip() function is now a generator in Python 3.0.  There is an
example of using the zip() function in the Python 3.0 tutorial,
http://docs.python.org/dev/3.0/tutorial/datastructures.html.

When running the example, I got:

>>> mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> zip(*mat)
<zip object at 0x70fc60>

I wrapped it in a call to list() to get the example output:

>>> list(zip(*mat))
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]


The attached patch file contains this change.
msg70884 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-08-08 06:44
Thanks, applied in r65592.
History
Date User Action Args
2008-08-08 06:44:21georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg70884
2008-08-08 00:11:52jsizelovecreate