Changes by Andrew Chong :
--
nosy: sledge76
severity: normal
status: open
title: list of list created by *
versions: Python 2.6
___
Python tracker
<http://bugs.python.org/issue7
New submission from Andrew Chong :
This shows unexpected behavior.
>>> data2 = [[]] * 4
>>> print data2
[[], [], [], []]
>>> data2[0] += [(0,1)]
>>> print data2
[[(0, 1)], [(0, 1)], [(0, 1)], [(0, 1)]]
I added a tuple to only 0th list, but it got added
Andrew Chong added the comment:
But this works fine.
>>> data = []
>>> data += [[]]
>>> data += [[]]
>>> data += [[]]
>>> data += [[]]
>>> print data
[[], [], [], []]