classification
Title: documentation of zip function is error
Type: Stage:
Components: Documentation Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: bones7456, georg.brandl
Priority: normal Keywords:

Created on 2009-05-22 09:17 by bones7456, last changed 2009-05-22 09:33 by georg.brandl. This issue is now closed.

Messages (3)
msg88182 - (view) Author: bones7456 (bones7456) Date: 2009-05-22 09:17
http://docs.python.org/library/functions.html?highlight=zip#zip

In this page, the example is error:

Python 2.6.2 (r262:71600, Apr 24 2009, 10:04:30) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> zipped
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zipped)
>>> x == x2, y == y2
(False, False)

The last line is "(False, False)", not True.
msg88183 - (view) Author: bones7456 (bones7456) Date: 2009-05-22 09:23
>>> type(x)
<type 'list'>
>>> type(x2)
<type 'tuple'>

It cann't be equal...
msg88184 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-05-22 09:33
Thanks, fixed in r72822.
History
Date User Action Args
2009-05-22 09:33:33georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg88184
2009-05-22 09:23:01bones7456setmessages: + msg88183
2009-05-22 09:17:49bones7456create