On 8 Gen, 16:45, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Giampaolo Rodola' wrote: > > To flush a list it is better doing "del mylist[:]" or "mylist = []"? > > Is there a preferred way? If yes, why? > > The latter creates a new list object, the former modifies an existing > list in place. > > The latter is shorter, reads better, and is probably a bit faster in > most cases. > > The former should be used when it's important to clear a specific list > object (e.g. if there are multiple references to the list). > > </F>
I'm going to use the latter one, thanks. -- http://mail.python.org/mailman/listinfo/python-list