summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-01-02 19:22:48 (GMT)
committerFred Drake <fdrake@acm.org>2001-01-02 19:22:48 (GMT)
commit2cba0f641fcfb57cc9218099fadc33d7d3d3deae (patch)
tree076f82839dcf52061ad7c5d7cf683ba4ec193a4c /Doc
parentb19f1e3701148b7d6867fb6ac9b72b75f0ef5cba (diff)
downloadcpython-2cba0f641fcfb57cc9218099fadc33d7d3d3deae.zip
cpython-2cba0f641fcfb57cc9218099fadc33d7d3d3deae.tar.gz
cpython-2cba0f641fcfb57cc9218099fadc33d7d3d3deae.tar.bz2
Improve description of else clause of the try/except/else statement.
This closes (again!) bug #127098.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/ref/ref7.tex17
1 files changed, 11 insertions, 6 deletions
diff --git a/Doc/ref/ref7.tex b/Doc/ref/ref7.tex
index 9541718..d5db0a8 100644
--- a/Doc/ref/ref7.tex
+++ b/Doc/ref/ref7.tex
@@ -181,7 +181,7 @@ try_exc_stmt: "try" ":" suite
("except" [expression ["," target]] ":" suite)+
["else" ":" suite]
try_fin_stmt: "try" ":" suite
- "finally" ":" suite
+ "finally" ":" suite
\end{verbatim}
There are two forms of \keyword{try} statement:
@@ -242,12 +242,17 @@ that handled an exception.
\withsubitem{(in module sys)}{\ttindex{exc_type}
\ttindex{exc_value}\ttindex{exc_traceback}}
-The optional \keyword{else} clause is executed when the \keyword{try} clause
-terminates by any means other than an exception or executing a
-\keyword{return}, \keyword{continue} or \keyword{break} statement.
-Exceptions in the \keyword{else} clause are not handled by the preceding
-\keyword{except} clauses.
+The optional \keyword{else} clause is executed if and when control
+flows off the end of the \keyword{try} clause.\footnote{
+ 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.
+} Exceptions in the \keyword{else} clause are not handled by the
+preceding \keyword{except} clauses.
\kwindex{else}
+\stindex{return}
+\stindex{break}
+\stindex{continue}
The \keyword{try}...\keyword{finally} form specifies a `cleanup' handler. The
\keyword{try} clause is executed. When no exception occurs, the