Merge from 3.2

This commit is contained in:
Nick Coghlan 2012-06-07 22:42:29 +10:00
commit cbc203e655
1 changed files with 7 additions and 0 deletions

View File

@ -187,6 +187,13 @@ following loop, which searches for prime numbers::
(Yes, this is the correct code. Look closely: the ``else`` clause belongs to
the :keyword:`for` loop, **not** the :keyword:`if` statement.)
When used with a loop, the ``else`` clause has more in common with the
``else`` clause of a :keyword:`try` statement than it does that of
:keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs
when no exception occurs, and a loop's ``else`` clause runs when no ``break``
occurs. For more on the :keyword:`try` statement and exceptions, see
:ref:`tut-handling`.
.. _tut-pass: