On Wed, Jan 23, 2013 at 2:48 AM, Thomas Boell <tboell@domain.invalid> wrote: > On Wed, 23 Jan 2013 02:42:27 +1100 > Chris Angelico <ros...@gmail.com> wrote: > >> On Wed, Jan 23, 2013 at 2:39 AM, Thomas Boell <tboell@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'? >> >> Other things can have else, including 'for' and 'while' loops. :) > > I must say, that's bound to be confusing for anyone who knows any > language other than Python (or none, even). Syntax like that is "an > accident waiting to happen"...
It can be confusing and does take that bit of learning, but it's SO handy. In C code, I sometimes simulate it with a 'goto' and a comment, but the actual keyword is much clearer. ChrisA -- http://mail.python.org/mailman/listinfo/python-list