Steve Holden <st...@holdenweb.com> writes:

> I think the choice of keyword is probably not Guido's crowning
> language achievement,

I remember the behaviour by considering a typical application:

        for thing in things:
          if shinyp(thing):
            break
        else:
          raise DullError, 'nothing shiny found'

In this kind of search loop, `break' signifies a kind of successful
completion: the `for' loop can be considered to be a test acting over an
iterable, and `else' therefore denotes the action if the test fails.

I don't know whether that's the official intuition, or even if there is
an official intuition, but it works well enough for me.  I'm quite fond
of Python's extra `else' clauses in `for' and (particularly) `try'.

-- [mdw]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to