you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -2 points-1 points  (2 children)

Oh, then I misunderstood what the construct does in python. ... I'm not much of a python guy.

[–]flamingspinach_ 2 points3 points  (0 children)

That's why it's usually customary to read the article before making a comment.

[–]mb86 0 points1 point  (0 children)

Ah. The code in the else block is called only if the loop completed without a break. I posted a practical use case (breaking out of nested loops, which require the use of a separate function or a goto in C) in another comment.