diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2012-06-07 12:42:29 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-06-07 12:42:29 (GMT) |
commit | cbc203e655e0c1184d67f02864353de5b01c7bc0 (patch) | |
tree | db8029c7e9be9f5f01db2c103c3c548210f06249 /Doc/tutorial | |
parent | 55e5dc8371bb29e970b0f94384d042b0f4aaac16 (diff) | |
parent | a3a164a03c78d66539f4fe9abf8d1dd5c08babaa (diff) | |
download | cpython-cbc203e655e0c1184d67f02864353de5b01c7bc0.zip cpython-cbc203e655e0c1184d67f02864353de5b01c7bc0.tar.gz cpython-cbc203e655e0c1184d67f02864353de5b01c7bc0.tar.bz2 |
Merge from 3.2
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/controlflow.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 5ed5aea..902f2bd 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -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: |