8000 [2.7] bpo-33699: Describe try's else clause with the rest of the try … · python/cpython@fb8eb2c · GitHub
[go: up one dir, main page]

Skip to content

Commit fb8eb2c

Browse files
andresdelfinomiss-islington
authored andcommitted
[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 b086c8a) https://bugs.python.org/issue33699
1 parent 0d16526 commit fb8eb2c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,11 @@ function that handled an exception.
281281
statement: break
282282
statement: continue
283283

284-
The optional :keyword:`else` clause is executed if and when control flows off
285-
the end of the :keyword:`try` clause. [#]_ Exceptions in the :keyword:`else`
286-
clause are not handled by the preceding :keyword:`except` clauses.
284+
The optional :keyword:`else` clause is executed if the control flow leaves the
285+
:keyword:`try` suite, no exception was raised, and no :keyword:`return`,
286+
:keyword:`continue`, or :keyword:`break` statement was executed. Exceptions in
287+
the :keyword:`else` clause are not handled by the preceding :keyword:`except`
288+
clauses.
287289

288290
.. index:: keyword: finally
289291

@@ -596,10 +598,6 @@ which is then bound to the class name.
596598
there is a :keyword:`finally` clause which happens to raise another
597599
exception. That new exception causes the old one to be lost.
598600
599-
.. [#] Currently, control "flows off the end" except in the case of an exception or the
600-
execution of a :keyword:`return`, :keyword:`continue`, or :keyword:`break`
601-
statement.
602-
603601
.. [#] A string literal appearing as the first statement in the function body is
604602
transformed into the function's ``__doc__`` attribute and therefore the
605603
function's :term:`docstring`.

0 commit comments

Comments
 (0)
0