newbie questions
Fredrik Lundh
fredrik at pythonware.com
Sun Dec 12 03:46:57 EST 2004
John Machin wrote:
>> Of course, in this simple case, I wouldn't be likely to write the clear
>> function since the inline code is simpler and has less overhead:
>>
>> def main()
>> var1 = []
>> var1.append('a')
>> var1[:] = []
>
> Even less overhead: del var1[:]
even less overhead:
var1 = []
(if you rely on having multiple references to the same list, instead of referring
to the list by name, you may want to reconsider the design)
</F>
More information about the Python-list
mailing list