• Home
  • Raw
  • Download

Lines Matching refs:keyword

96 The :keyword:`try` statement works as follows.
98 * First, the *try clause* (the statement(s) between the :keyword:`try` and
99 :keyword:`except` keywords) is executed.
102 :keyword:`try` statement is finished.
104 * If an exception occurs during execution of the :keyword:`try` clause, the rest of 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
117 not in other handlers of the same :keyword:`!try` statement. An *except clause*
123 A class in an :keyword:`except` clause is compatible with an exception if it is
172 The :keyword:`try` ... :keyword:`except` statement has an optional *else
186 The use of the :keyword:`!else` clause is better than adding additional code to
187 the :keyword:`try` clause because it avoids accidentally catching an exception
188 that wasn't raised by the code being protected by the :keyword:`!try` ...
189 :keyword:`!except` statement.
242 The :keyword:`raise` statement allows the programmer to force a specified
250 The sole argument to :keyword:`raise` indicates the exception to be raised.
258 handle it, a simpler form of the :keyword:`raise` statement allows you to
278 The :keyword:`raise` statement allows an optional :keyword:`from<raise>` which enables
306 :keyword:`except` or :keyword:`finally` section. This can be
347 The :keyword:`try` statement has another optional clause which is intended to
361 If a :keyword:`finally` clause is present, the :keyword:`!finally`
362 clause will execute as the last task before the :keyword:`try`
363 statement completes. The :keyword:`!finally` clause runs whether or
364 not the :keyword:`!try` statement produces an exception. The following
367 * If an exception occurs during execution of the :keyword:`!try`
368 clause, the exception may be handled by an :keyword:`except`
369 clause. If the exception is not handled by an :keyword:`!except`
370 clause, the exception is re-raised after the :keyword:`!finally`
373 * An exception could occur during execution of an :keyword:`!except`
374 or :keyword:`!else` clause. Again, the exception is re-raised after
375 the :keyword:`!finally` clause has been executed.
377 * If the :keyword:`!finally` clause executes a :keyword:`break`,
378 :keyword:`continue` or :keyword:`return` statement, exceptions are not
381 * If the :keyword:`!try` statement reaches a :keyword:`break`,
382 :keyword:`continue` or :keyword:`return` statement, the
383 :keyword:`!finally` clause will execute just prior to the
384 :keyword:`!break`, :keyword:`!continue` or :keyword:`!return`
387 * If a :keyword:`!finally` clause includes a :keyword:`!return`
389 :keyword:`!finally` clause's :keyword:`!return` statement, not the
390 value from the :keyword:`!try` clause's :keyword:`!return`
429 As you can see, the :keyword:`finally` clause is executed in any event. The
431 :keyword:`except` clause and therefore re-raised after the :keyword:`!finally`
434 In real world applications, the :keyword:`finally` clause is useful for
455 applications. The :keyword:`with` statement allows objects like files to be