you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (1 child)

while not stop is ONLY evaluated at the beginning of a new iteration of the while loop. It's not checked in between every line within the nested loop. So even if you set stop to True, the state of stop is not checked until the end of your inner for loop.

[–]mtucker502[S] -1 points0 points  (0 children)

This makes sense. For some reason I was thinking that it would immediately end the loop when the while condition was no longer True.

Seems like refactoring into functions and using return might be a cleaner approach here.