No I'm well aware that there is no deep copy of the objects and the lists only keep references to the objects and in essence they have the same objects in there. But this doesn't mean they are the same list. Modifications to slices are not written back to the original list.<div>
<br></div><div>x = range(5)</div><div>y = x[1:3]</div><div>y[0] = 13</div><div>x[1] == y[0] --> False</div><div><br></div><div>Of course if I modify the object in the slice then the original list will see the change, but this is not what I was saying. Second and more importantly it's the performance penalty from allocating a large number of lists produced from the slices and the copy of the references. islice does not have this penalty, it should only instantiate a small object that iterates on the original list.</div>
<div><br clear="all">Themis<br>
<br><br><div class="gmail_quote">On Thu, Nov 19, 2009 at 3:00 AM, Rami Chowdhury <span dir="ltr"><<a href="mailto:rami.chowdhury@gmail.com">rami.chowdhury@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br></div>I'm not sure you're understanding the point others have been making. A<br>
list item is merely another reference to an existing object -- it<br>
doesn't copy the object in any way.<br>
<div><div></div><div class="h5"><br></div></div></blockquote></div></div>