[Python-checkins] bpo-33699: Describe try's else clause with the rest of the try clause (GH-7252)

Miss Islington (bot) webhook-mailer at python.org
Sun Nov 11 14:44:34 EST 2018


https://github.com/python/cpython/commit/3f6a0a292e12f737448a11660da0c880e8f972be
commit: 3f6a0a292e12f737448a11660da0c880e8f972be
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-11-11T11:44:31-08:00
summary:

bpo-33699: Describe try's else clause with the rest of the try clause (GH-7252)


https://bugs.python.org/issue33699
(cherry picked from commit b086c8afdb8c862011e3e27d4c8f6833749f2c56)

Co-authored-by: Andrés Delfino <adelfino at gmail.com>

files:
M Doc/reference/compound_stmts.rst

diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index f8d7afbe496c..8d050a69a931 100644
--- a/Doc/reference/compound_stmts.rst
+++ b/Doc/reference/compound_stmts.rst
@@ -314,9 +314,11 @@ from a function that handled an exception.
    statement: break
    statement: continue
 
-The optional :keyword:`else` clause is executed if and when control flows off
-the end of the :keyword:`try` clause. [#]_ Exceptions in the :keyword:`else`
-clause are not handled by the preceding :keyword:`except` clauses.
+The optional :keyword:`else` clause is executed if the control flow leaves the
+:keyword:`try` suite, no exception was raised, and no :keyword:`return`,
+:keyword:`continue`, or :keyword:`break` statement was executed.  Exceptions in
+the :keyword:`else` clause are not handled by the preceding :keyword:`except`
+clauses.
 
 .. index:: keyword: finally
 
@@ -831,10 +833,6 @@ It is a :exc:`SyntaxError` to use ``async with`` statement outside of an
    there is a :keyword:`finally` clause which happens to raise another
    exception. That new exception causes the old one to be lost.
 
-.. [#] Currently, control "flows off the end" except in the case of an exception
-   or the execution of a :keyword:`return`, :keyword:`continue`, or
-   :keyword:`break` statement.
-
 .. [#] A string literal appearing as the first statement in the function body is
    transformed into the function's ``__doc__`` attribute and therefore the
    function's :term:`docstring`.



More information about the Python-checkins mailing list