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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to