Bug with lists of pairs of lists and append()
zachREMOVE at MEin.tu-clausthal.de
Fri Sep 28 21:00:45 CEST 2007
could some kind soul please explain to me why the following trivial code
s = 
l = [ 0 ]
r = [0, 0]
x = (l,r)
s.append( x )
l.append( r.pop(0) )
The output I get is:
(, [0, 0])
([0, 0], )
[([0, 0, 0], ), ([0, 0, 0], )]
and the error is in the last line: the two pairs in the outer list are
identical and they should be equal to the pairs one the first and the
2nd line, respectively! Shouldn't they?
I think I'm going nuts -- for the life of me I don't see what's going on ...
Thanks a lot in advance for any insights, etc.
More information about the Python-list