emptying a list

Simon Forman sajmikins at gmail.com
Thu Oct 1 21:39:17 EDT 2009


On Thu, Oct 1, 2009 at 11:30 AM, lallous <lallous at lgwm.org> wrote:
> Hello
>
> What is faster when clearing a list?
>
> del L[:]
>
> or
>
> L = []
>
> --
> Elias
> --
> http://mail.python.org/mailman/listinfo/python-list
>

The first form actually clears the list, the second for just re-binds
the name 'L' to a new, empty list.



More information about the Python-list mailing list