newbie questions

Fredrik Lundh fredrik at
Sun Dec 12 09:46:57 CET 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)


More information about the Python-list mailing list