On 06/29/2012 01:29 PM, Will Woods wrote:
Apparently, if you have an 'else:' block after 'for:', it gets executed if you 'break' out of the loop. Neat!
Er, no... Reading the documentation at http://docs.python.org/reference/compound_stmts.html#the-for-statement if you break, you'll by-pass the else: clause. If you want to get out of the loop but still run through the else you have to use 'continue'.