summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Delfino <adelfino@gmail.com>2018-11-11 19:33:51 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-11-11 19:33:51 (GMT)
commitb086c8afdb8c862011e3e27d4c8f6833749f2c56 (patch)
tree909ad16b3361e00a0aae427b4a40a7b3ebed1cd7
parent76e8fd7b7ee0b3d18e7df960a2f7d5c3fad5f15d (diff)
downloadcpython-b086c8afdb8c862011e3e27d4c8f6833749f2c56.zip
cpython-b086c8afdb8c862011e3e27d4c8f6833749f2c56.tar.gz
cpython-b086c8afdb8c862011e3e27d4c8f6833749f2c56.tar.bz2
bpo-33699: Describe try's else clause with the rest of the try clause (GH-7252)
https://bugs.python.org/issue33699
-rw-r--r--Doc/reference/compound_stmts.rst12
1 files changed, 5 insertions, 7 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst
index 0dc7ecf..474ec88 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
@@ -847,10 +849,6 @@ body of a coroutine function.
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`.