[EMAIL PROTECTED] wrote:
> And so on. For every use of the for/else clause there exists a better
> alternative. Which sums up my opinion about the construct -- if you
> are using it, there's something wrong with your code.

How do you transform this?

height = 0
for block in stack:
    if block.is_marked():
        print "Lowest marked block is at height", height
        break
    height += block.height
else:
    raise SomeError("No marked block")

-M-

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to