how to clear up a List in python?
Mel Wilson
mwilson-to at sympatico.ca
Fri May 26 12:21:56 EDT 2006
linnorm at gmail.com wrote:
> The original post only mentions deleting the values in the list, not
> the list itself. Given that you want to keep the list and just ditch
> the values it contains I'd go with:
>
> list1 = []
Depends what you mean by "keep the list". Consider
class C (object):
def __init__ (self, things):
self.things = things
a = range (5)
b = C (a)
a = []
print b.things
d = range (5)
e = C (d)
d[:] = []
print e.things
These are very different.
Mel.
More information about the Python-list
mailing list