Else statement executing when it shouldnt

Duncan Booth duncan.booth at invalid.invalid
Tue Jan 22 16:48:11 CET 2013


Thomas Boell <tboell at domain.invalid> wrote:

> Huh?! I would have expected all your examples to raise a SyntaxError or
> IndentationError. Why don't they? Is 'else' not required to have a
> matching 'if'?
> 

Matching 'if' or 'for' or 'while'.
See http://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops

-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list