From 82e6880de9725ff5fbf80fe70345689c0df19b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Wed, 30 May 2018 16:35:00 -0300 Subject: [PATCH 1/3] Initial commit --- Doc/reference/compound_stmts.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 5076e5df00789a..059ccac8ecee9c 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -308,9 +308,10 @@ 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 no exception was raised, and +if 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 @@ -815,10 +816,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`. From b5fb7670a7afe592b8d83a1b3019fb1c4508714f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Tue, 12 Jun 2018 16:02:49 -0300 Subject: [PATCH 2/3] Address Tal comment --- Doc/reference/compound_stmts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 059ccac8ecee9c..7e2c2317fe2b70 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -309,7 +309,7 @@ from a function that handled an exception. statement: continue The optional :keyword:`else` clause is executed if no exception was raised, and -if no :keyword:`return`, :keyword:`continue`, or :keyword:`break` statement was +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. From 89cc110053e6416530c88418684b4145fd38fdea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Delfino?= Date: Mon, 22 Oct 2018 16:25:36 -0300 Subject: [PATCH 3/3] Address Pablo's comment --- Doc/reference/compound_stmts.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 7e2c2317fe2b70..479243cb2a3432 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -308,10 +308,11 @@ from a function that handled an exception. statement: break statement: continue -The optional :keyword:`else` clause is executed if 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. +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