Re: Coding style
- From: rurpy@xxxxxxxxx
- Date: 17 Jul 2006 13:42:49 -0700
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.
.
- Follow-Ups:
- Re: Coding style
- From: Bob Greschke
- Re: Coding style
- References:
- Coding style
- From: PTY
- Coding style
- Prev by Date: Re: Python for Embedded Systems?
- Next by Date: Re: Track keyboard and mouse usage
- Previous by thread: Re: Coding style
- Next by thread: Re: Coding style
- Index(es):
Relevant Pages
|