Lines Matching refs:keyword
14 The :keyword:`if`, :keyword:`while` and :keyword:`for` statements implement
15 traditional control flow constructs. :keyword:`try` specifies exception
26 identifying keyword and ends with a colon. A suite is a group of statements
31 mostly because it wouldn't be clear to which :keyword:`if` clause a following
32 :keyword:`else` clause would belong: ::
37 that in the following example, either all or none of the :keyword:`print`
64 keyword that cannot start a statement, thus there are no ambiguities (the
65 'dangling :keyword:`else`' problem is solved in Python by requiring nested
66 :keyword:`if` statements to be indented).
76 The :keyword:`if` statement
81 keyword: elif
82 keyword: else
84 The :keyword:`if` statement is used for conditional execution:
94 :keyword:`if` statement is executed or evaluated). If all expressions are
95 false, the suite of the :keyword:`else` clause, if present, is executed.
100 The :keyword:`while` statement
106 keyword: else
108 The :keyword:`while` statement is used for repeated execution as long as an
117 suite of the :keyword:`else` clause, if present, is executed and the loop
124 A :keyword:`break` statement executed in the first suite terminates the loop
125 without executing the :keyword:`else` clause's suite. A :keyword:`continue`
132 The :keyword:`for` statement
138 keyword: in
139 keyword: else
143 The :keyword:`for` statement is used to iterate over the elements of a sequence
156 the :keyword:`else` clause, if present, is executed, and the loop terminates.
162 A :keyword:`break` statement executed in the first suite terminates the loop
163 without executing the :keyword:`else` clause's suite. A :keyword:`continue`
165 with the next item, or with the :keyword:`else` clause if there was no next
207 The :keyword:`try` statement
212 keyword: except
213 keyword: finally
215 The :keyword:`try` statement specifies exception handlers and/or cleanup code
228 In previous versions of Python, :keyword:`try`...\ :keyword:`except`...\
229 :keyword:`finally` did not work. :keyword:`try`...\ :keyword:`except` had to be
230 nested in :keyword:`try`...\ :keyword:`finally`.
232 The :keyword:`except` clause(s) specify one or more exception handlers. When no
233 exception occurs in the :keyword:`try` clause, no exception handler is executed.
234 When an exception occurs in the :keyword:`try` suite, a search for an exception
249 as if the entire :keyword:`try` statement raised the exception).
279 keyword: else
284 The optional :keyword:`else` clause is executed if and when control flows off
285 the end of the :keyword:`try` clause. [#]_ Exceptions in the :keyword:`else`
286 clause are not handled by the preceding :keyword:`except` clauses.
288 .. index:: keyword: finally
290 If :keyword:`finally` is present, it specifies a 'cleanup' handler. The
291 :keyword:`try` clause is executed, including any :keyword:`except` and
292 :keyword:`else` clauses. If an exception occurs in any of the clauses and is
293 not handled, the exception is temporarily saved. The :keyword:`finally` clause
295 :keyword:`finally` clause. If the :keyword:`finally` clause raises another
296 exception or executes a :keyword:`return` or :keyword:`break` statement, the
309 the :keyword:`finally` clause.
316 When a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement is
317 executed in the :keyword:`try` suite of a :keyword:`try`...\ :keyword:`finally`
318 statement, the :keyword:`finally` clause is also executed 'on the way out.' A
319 :keyword:`continue` statement is illegal in the :keyword:`finally` clause. (The
323 The return value of a function is determined by the last :keyword:`return`
324 statement executed. Since the :keyword:`finally` clause always executes, a
325 :keyword:`return` statement executed in the :keyword:`finally` clause will
338 and information on using the :keyword:`raise` statement to generate exceptions
345 The :keyword:`with` statement
354 The :keyword:`with` statement is used to wrap the execution of a block with
356 allows common :keyword:`try`...\ :keyword:`except`...\ :keyword:`finally` usage
363 The execution of the :keyword:`with` statement with one "item" proceeds as follows:
372 #. If a target was included in the :keyword:`with` statement, the return value
377 The :keyword:`with` statement guarantees that if the :meth:`__enter__` method
392 statement following the :keyword:`with` statement.
399 :keyword:`with` statements were nested::
412 In Python 2.5, the :keyword:`with` statement is only allowed when the
422 The specification, background, and examples for the Python :keyword:`with`
522 list, either from position arguments, from keyword arguments, or from default
526 receiving any excess keyword arguments, defaulting to a new empty dictionary.
533 simplified function definition; a function defined in a ":keyword:`def`"
535 defined by a lambda expression. The ":keyword:`def`" form is actually more powerful
596 there is a :keyword:`finally` clause which happens to raise another
600 execution of a :keyword:`return`, :keyword:`continue`, or :keyword:`break`