bpo-33699: Describe try's else clause with the rest of the try clause… · python/cpython@b086c8a

@@ -314,9 +314,11 @@ from a function that handled an exception.

314314

statement: break

315315

statement: continue

316316317-

The optional :keyword:`else` clause is executed if and when control flows off

318-

the end of the :keyword:`try` clause. [#]_ Exceptions in the :keyword:`else`

319-

clause are not handled by the preceding :keyword:`except` clauses.

317+

The optional :keyword:`else` clause is executed if the control flow leaves the

318+

:keyword:`try` suite, no exception was raised, and no :keyword:`return`,

319+

:keyword:`continue`, or :keyword:`break` statement was executed. Exceptions in

320+

the :keyword:`else` clause are not handled by the preceding :keyword:`except`

321+

clauses.

320322321323

.. index:: keyword: finally

322324

@@ -847,10 +849,6 @@ body of a coroutine function.

847849

there is a :keyword:`finally` clause which happens to raise another

848850

exception. That new exception causes the old one to be lost.

849851850-

.. [#] Currently, control "flows off the end" except in the case of an exception

851-

or the execution of a :keyword:`return`, :keyword:`continue`, or

852-

:keyword:`break` statement.

853-854852

.. [#] A string literal appearing as the first statement in the function body is

855853

transformed into the function's ``__doc__`` attribute and therefore the

856854

function's :term:`docstring`.