[docs] code-example doesn't work as displayed in documentation

Martin mpc4 at gmx.com
Thu Aug 2 08:11:38 CEST 2012


http://docs.python.org/py3k/tutorial/datastructures.html#nested-list-comprehensions

the code-example in the last paragraph of nested list comprehensions 
doesn't work like displayed.

displayed:

 >>> zip(*matrix)
[(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]



but works like that:

 >>> zip(*matrix)
<zip object at 0x7fd9d8a660e0>



to make it work like displayed i had to type:

 >>> list(zip(*matrix))
[(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]


i guess the example was just copied from the 2.7.3 python documentation 
because it worked like displayed with Python 2.7.3, but not with Python 
3.2.3

Regards
Martin


More information about the docs mailing list