PTY wrote: > Which is better? > > lst = [1,2,3,4,5] > > while lst: > lst.pop() > > OR > > while len(lst) > 0: > lst.pop()
A dozen posts, but nobody has posted the right answer yet, so I will :-) It doesn't matter -- use whichever you prefer (*) This is an angels on the head of a pin issue. (*) -- If your code is part of an existing body of code that uses one or the other style consistently, then you should do the same. -- http://mail.python.org/mailman/listinfo/python-list