forcing list garbage collection
Alex Martelli
aleax at aleax.it
Fri Oct 11 14:52:33 EDT 2002
les wrote:
> Hi,
> dictionaries have a clear() method, do lists have something similar?
alist[:] = []
for example. Or, "del alist[:]".
> i would like to list to empty and memory recollected right away.
Just like adict with adict.clear(), alist does become empty with
this slice assignment or deletion -- but when the memory is
collected is not guaranteed and is an implementation detail
(exactly like for adict.clear(), again).
Alex
More information about the Python-list
mailing list