Hello I found this very strange; is it a bug, is it a "feature", am I
being naughty or what?

>>> foo = [[0, 0], [0, 0]]
>>> baz = [ [0]*2 ] * 2
>>> foo
[[0, 0], [0, 0]]
>>> baz
[[0, 0], [0, 0]]
>>> foo[0][0]=1
>>> baz[0][0]=1
>>> foo
[[1, 0], [0, 0]]
>>> baz
[[1, 0], [1, 0]]

Why on earth does foo and baz behave differently??

Btw.:
Python 2.4.1 (#1, Apr 10 2005, 22:30:36)
[GCC 3.3.5] on linux2

--- Jon Øyvind

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to