On Fri, 18 Jun 2010 12:07:38 +0100, bart.c wrote:

> (Although I have an issue with the way that that append works. I tried
> it in another, simpler language (which always does deep copies):
> 
> L:=(1,2,3)
> L append:= L
> print L
> 
> output:  (1,2,3,(1,2,3))
> 
> which is exactly what I'd expect, 
> and not (1,2,3,(1,2,3,(1,2,3,...))) )

I find that behaviour a big surprise. You asked to append the list L, not 
a copy of the list L. So why is this "simpler" language making a copy 
without being asked?

If you asked for:

L:=(1,2,3)
M:=(0,1)
M append:= L

does it also append a copy of L instead of L? If so, how do you append 
the original rather than wastefully making a copy? If L is huge, making a 
copy before appending will be slow, and potentially fail.



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

Reply via email to