Coding style

Simon Brunning simon at brunningonline.net
Mon Jul 17 12:09:32 EDT 2006


On 17 Jul 2006 08:56:34 -0700, PTY <ty.2006 at yahoo.com> wrote:
> Which is better?
>
> lst = [1,2,3,4,5]
>
> while lst:
>   lst.pop()
>
> OR
>
> while len(lst) > 0:
>   lst.pop()

How about:

lst = [1,2,3,4,5]
while lst:
    lst.pop()

Or even just:

lst = []

;-)

-- 
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list