diff options
author | Andrés Delfino <adelfino@gmail.com> | 2018-11-11 17:09:03 -0300 |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-11-11 12:09:03 -0800 |
commit | fb8eb2c2776efb34523e0a616c6f845a6b975e38 (patch) | |
tree | dacb0e57cc7b0cc11aee611732d246b7d9e59a85 /Doc | |
parent | 0d165262d949440e5aea6533b10e19e4cd5cf12d (diff) | |
download | cpython-git-fb8eb2c2776efb34523e0a616c6f845a6b975e38.tar.gz |
[2.7] bpo-33699: Describe try's else clause with the rest of the try clause (GH-7252) (GH-10469)
https://bugs.python.org/issue33699
(cherry picked from commit b086c8afdb8c862011e3e27d4c8f6833749f2c56)
https://bugs.python.org/issue33699
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/reference/compound_stmts.rst | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 92ce3cdeed..523d9b59f7 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -281,9 +281,11 @@ 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 @@ -596,10 +598,6 @@ which is then bound to the class name. 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`. |