On 1 Oct, 16:30, "lallous" <lall...@lgwm.org> wrote: > Hello > > What is faster when clearing a list? > > del L[:] > > or > > L = [] > > -- > Elias
Does it really matter that much? And you're really talking about two different things, which quite often come up on this group. Example follows: >>> x = range(5) >>> x = y >>> print x, y [1, 2, 3, 4] [1, 2, 3, 4] >>> x = [] >>> print x, y [] [1, 2, 3, 4] >>> x = y >>> print x, y [1, 2, 3, 4] [1, 2, 3, 4] >>> del x[:] >>> print x, y [] [] Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list