mirror of
https://github.com/python/cpython.git
synced 2025-11-07 21:29:26 +00:00
Added paragraph explaining that except clauses can't be empty; that
pass can be used if needed. By Dan Wolfe <wolfeman@apple.com>.
This commit is contained in:
parent
4c2533fe3c
commit
2900ff9382
1 changed files with 4 additions and 0 deletions
|
|
@ -2751,6 +2751,10 @@ wildcard.
|
||||||
Use this with extreme caution, since it is easy to mask a real
|
Use this with extreme caution, since it is easy to mask a real
|
||||||
programming error in this way!
|
programming error in this way!
|
||||||
|
|
||||||
|
Each exception clause must have at least one line of executable code
|
||||||
|
in the block. Comments are not executable code. If you want the
|
||||||
|
exception clause to do nothing, use the \keyword{pass} statement.
|
||||||
|
|
||||||
The \keyword{try} \ldots\ \keyword{except} statement has an optional
|
The \keyword{try} \ldots\ \keyword{except} statement has an optional
|
||||||
\emph{else clause}, which must follow all except clauses. It is
|
\emph{else clause}, which must follow all except clauses. It is
|
||||||
useful to place code that must be executed if the try clause does not
|
useful to place code that must be executed if the try clause does not
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue