Coding style
rurpy at yahoo.com
rurpy at yahoo.com
Mon Jul 17 16:42:49 EDT 2006
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.
More information about the Python-list
mailing list