8000 [2.7] bpo-33699: Describe try's else clause with the rest of the try clause (GH-7252) by andresdelfino · Pull Request #10469 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

[2.7] bpo-33699: Describe try's else clause with the rest of the try clause (GH-7252) #10469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 11, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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`.
Expand Down
0