bpo-33699: Describe try's else clause with the rest of the try clause by andresdelfino · Pull Request #7252 · python/cpython
Expand Up
@@ -308,9 +308,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
Expand Down Expand Up @@ -815,10 +817,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`. Expand Down
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
Expand Down Expand Up @@ -815,10 +817,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`. Expand Down