Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2cba0f6

Browse files
committed
Improve description of else clause of the try/except/else statement.
This closes (again!) bug #127098.
1 parent b19f1e3 commit 2cba0f6

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Doc/ref/ref7.tex

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ \section{The \keyword{try} statement\label{try}}
181181
("except" [expression ["," target]] ":" suite)+
182182
["else" ":" suite]
183183
try_fin_stmt: "try" ":" suite
184-
"finally" ":" suite
184+
"finally" ":" suite
185185
\end{verbatim}
186186

187187
There are two forms of \keyword{try} statement:
@@ -242,12 +242,17 @@ \section{The \keyword{try} statement\label{try}}
242242
\withsubitem{(in module sys)}{\ttindex{exc_type}
243243
\ttindex{exc_value}\ttindex{exc_traceback}}
244244

245-
The optional \keyword{else} clause is executed when the \keyword{try} clause
246-
terminates by any means other than an exception or executing a
247-
\keyword{return}, \keyword{continue} or \keyword{break} statement.
248-
Exceptions in the \keyword{else} clause are not handled by the preceding
249-
\keyword{except} clauses.
245+
The optional \keyword{else} clause is executed if and when control
246+
flows off the end of the \keyword{try} clause.\footnote{
247+
Currently, control ``flows off the end'' except in the case of an
248+
exception or the execution of a \keyword{return},
249+
\keyword{continue}, or \keyword{break} statement.
250+
} Exceptions in the \keyword{else} clause are not handled by the
251+
preceding \keyword{except} clauses.
250252
\kwindex{else}
253+
\stindex{return}
254+
\stindex{break}
255+
\stindex{continue}
251256

252257
The \keyword{try}...\keyword{finally} form specifies a `cleanup' handler. The
253258
\keyword{try} clause is executed. When no exception occurs, the

0 commit comments

Comments
 (0)