style question: how to delete all elements in a list

Delaney, Timothy (Tim) tdelaney at
Mon Mar 6 22:50:12 EST 2006

gry at wrote:

> To delete all the elements of a list, should one do:
>    lst[:] = []
> or
>    del(lst[:])

del lst[:]

Note that del is not a function - the parentheses are not needed, and in
fact obscure the intent.

Tim Delaney

More information about the Python-list mailing list