newbie questions

Steven Bethard steven.bethard at gmail.com
Sun Dec 12 11:42:19 EST 2004


Fredrik Lundh wrote:
> 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)

Yes, that's what the next 4 lines of my message said. ;)

Steve



More information about the Python-list mailing list