Pop a list from beginning ? and memory saving...

Jeff Epler jepler at unpythonic.net
Wed Jun 5 08:37:07 EDT 2002

On Tue, Jun 04, 2002 at 11:36:39PM -0400, Peter Hansen wrote:
(speaking about this expression):
>> l[:] = []
> Oh, and in my opinion, that is obscure and deserves a
> comment explaining how it works, and why it is being done.
> I might not feel that way if I write that idiom a few times,
> though. :)

    del l[:]
is clearer than
    l[:] = []
I'd accept the first one immediately, and puzzle over the second one for
a short (or even long) time.


More information about the Python-list mailing list