Andreas Waldenburger wrote:

> It seems that there is a for...else construct. Replacing the inner if
> with pass seems to confirm this. The else clause is still executed.

Yes, there is a for...else construct.

The else block runs if the for loop exits *without* a break.

for i in range(20):
    if i == 10: break
else:
    print "no break here"

for i in range(20):
    if i == 100: break
else:
    print "no break here"


> What's broken here: Python or my brain?

Perhaps we should not answer that question.


-- 
Steven

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

Reply via email to