Help me write better Code
Ian Kelly
ian.g.kelly at gmail.com
Wed Jul 9 14:16:41 EDT 2014
On Wed, Jul 9, 2014 at 8:27 AM, sssdevelop <sssdevelop at gmail.com> wrote:
> prev = 0
> blocks = []
> tmp = []
> last = 0
> for element in a:
> if prev == 0:
Is 0 allowed to be in the input list? What would happen if it were?
> next
This line doesn't do anything. It looks up the builtin function named
next and then does nothing with it. I suspect you meant to use the
keyword 'continue' here.
> if tmp:
> pass
> else:
> tmp.append(prev)
if not tmp:
tmp.append(prev)
Also, give tmp a more meaningful name. Call it "current_block" or
something descriptive like that.
More information about the Python-list
mailing list