[issue7917] list of list created by *
Andrew Chong
report at bugs.python.org
Fri Feb 12 15:52:33 CET 2010
New submission from Andrew Chong <sledge76 at hotmail.com>:
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 to all the lists in the global list.
----------
components: +None
type: -> behavior
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7917>
_______________________________________
More information about the Python-bugs-list
mailing list