New submission from Abraham Smith:
Some students were working on matrix routines for practice.
The following code:
>>> L = [ [0]*3 ]*3
>>> for i in range(3):
...for j in range(3):
...if i==j: L[i][j]=1
was expected to return
[[1,0,0],[0,1,0],[0,0,1]]
but it return
Abraham Smith added the comment:
(Obviously, there's a copy/paste mistake in the second case; it should read
map(id, M).)
--
___
Python tracker
<http://bugs.python.org/is
Abraham Smith added the comment:
Thanks for the helpful responses and correcting my misunderstanding.
Regarding improved documentation, I see now that the table at
https://docs.python.org/2/library/stdtypes.html#id2 indeed says "shallow
copies"; however, the footnote seems to bur