<br><br><div class="gmail_quote">On Thu, Oct 1, 2009 at 10:13 PM, Jon Clements <span dir="ltr"><<a href="mailto:joncle@googlemail.com">joncle@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 1 Oct, 16:30, "lallous" <<a href="mailto:lall...@lgwm.org">lall...@lgwm.org</a>> wrote:<br>
> Hello<br>
><br>
> What is faster when clearing a list?<br>
><br>
> del L[:]<br>
><br>
> or<br>
><br>
> L = []<br>
><br>
> --<br>
> Elias<br>
<br>
</div>Does it really matter that much?<br>
<br>
And you're really talking about two different things, which quite<br>
often come up on this group.<br>
<br>
Example follows:<br>
<br>
>>> x = range(5)<br>
>>> x = y<br></blockquote><div><br>Is n't it y=x ? <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
>>> print x, y<br>
[1, 2, 3, 4] [1, 2, 3, 4]<br>
>>> x = []<br>
>>> print x, y<br>
[] [1, 2, 3, 4]<br>
>>> x = y<br>
>>> print x, y<br>
[1, 2, 3, 4] [1, 2, 3, 4]<br>
>>> del x[:]<br>
>>> print x, y<br>
[] []<br>
<br>
Cheers,<br>
<font color="#888888">Jon.<br>
</font><div><div></div><div class="h5">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Yours,<br>S.Selvam<br>