Lines Matching refs:clause
98 * First, the *try clause* (the statement(s) between the :keyword:`try` and
101 * If no exception occurs, the *except clause* is skipped and execution of the
104 * If an exception occurs during execution of the try clause, the rest of the
105 clause is skipped. Then if its type matches the exception named after the
106 :keyword:`except` keyword, the except clause is executed, and then execution
110 clause, it is passed on to outer :keyword:`try` statements; if no handler is
114 A :keyword:`try` statement may have more than one except clause, to specify
116 Handlers only handle exceptions that occur in the corresponding try clause, not
117 in other handlers of the same :keyword:`try` statement. An except clause may
131 The last except clause may omit the exception name(s), to serve as a wildcard.
151 clause*, which, when present, must follow all except clauses. It is useful for
152 code that must be executed if the try clause does not raise an exception. For
164 The use of the :keyword:`else` clause is better than adding additional code to
165 the :keyword:`try` clause because it avoids accidentally catching an exception
173 The except clause may specify a variable after the exception name (or tuple).
202 try clause, but also if they occur inside functions that are called (even
203 indirectly) in the try clause. For example::
331 The :keyword:`try` statement has another optional clause which is intended to
345 A *finally clause* is always executed before leaving the :keyword:`try`
347 occurred in the :keyword:`try` clause and has not been handled by an
348 :keyword:`except` clause (or it has occurred in an :keyword:`except` or
349 :keyword:`else` clause), it is re-raised after the :keyword:`finally` clause has
350 been executed. The :keyword:`finally` clause is also executed "on the way out"
351 when any other clause of the :keyword:`try` statement is left via a
364 ... print "executing finally clause"
368 executing finally clause
371 executing finally clause
373 executing finally clause
379 As you can see, the :keyword:`finally` clause is executed in any event. The
381 :keyword:`except` clause and therefore re-raised after the :keyword:`finally`
382 clause has been executed.
384 In real world applications, the :keyword:`finally` clause is useful for