.. index::
! statement: if
- keyword: elif
- keyword: else
+ pair: keyword; elif
+ pair: keyword; else
single: : (colon); compound statement
The :keyword:`if` statement is used for conditional execution:
.. index::
! statement: while
- keyword: else
+ pair: keyword; else
pair: loop; statement
single: : (colon); compound statement
.. index::
! statement: for
- keyword: in
- keyword: else
+ pair: keyword; in
+ pair: keyword; else
pair: target; list
pair: loop; statement
object: sequence
.. index::
! statement: try
- keyword: except
- keyword: finally
- keyword: else
- keyword: as
+ pair: keyword; except
+ pair: keyword; finally
+ pair: keyword; else
+ pair: keyword; as
single: : (colon); compound statement
The :keyword:`!try` statement specifies exception handlers and/or cleanup code
.. index::
- keyword: except_star
+ pair: keyword; except_star
.. _except_star:
.. index::
- keyword: else
+ pair: keyword; else
statement: return
statement: break
statement: continue
clauses.
-.. index:: keyword: finally
+.. index:: pair: keyword; finally
.. _finally:
.. index::
! statement: with
- keyword: as
+ pair: keyword; as
single: as; with statement
single: , (comma); with statement
single: : (colon); compound statement
.. index::
! statement: match
- ! keyword: case
+ ! pair: keyword; case
! single: pattern matching
- keyword: if
- keyword: as
+ pair: keyword; if
+ pair: keyword; as
pair: match; case
single: as; match statement
single: : (colon); compound statement
: ["->" `expression`] ":" `suite`
.. index::
- keyword: async
- keyword: await
+ pair: keyword; async
+ pair: keyword; await
Execution of Python coroutines can be suspended and resumed at many points
(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` and
-----------------
.. index::
- keyword: yield
- keyword: from
+ pair: keyword; yield
+ pair: keyword; from
pair: yield; expression
pair: generator; function
if that method was called.
-.. index:: keyword: await
+.. index:: pair: keyword; await
.. _await:
Await expression
:keyword:`return` leaves the current function call with the expression list (or
``None``) as return value.
-.. index:: keyword: finally
+.. index:: pair: keyword; finally
When :keyword:`return` passes control out of a :keyword:`try` statement with a
:keyword:`finally` clause, that :keyword:`!finally` clause is executed before
:keyword:`while` loop, but not nested in a function or class definition within
that loop.
-.. index:: keyword: else
+.. index:: pair: keyword; else
pair: loop control; target
It terminates the nearest enclosing loop, skipping the optional :keyword:`!else`
If a :keyword:`for` loop is terminated by :keyword:`break`, the loop control
target keeps its current value.
-.. index:: keyword: finally
+.. index:: pair: keyword; finally
When :keyword:`break` passes control out of a :keyword:`try` statement with a
:keyword:`finally` clause, that :keyword:`!finally` clause is executed before
statement: for
statement: while
pair: loop; statement
- keyword: finally
+ pair: keyword; finally
.. productionlist:: python-grammar
continue_stmt: "continue"
! statement: import
single: module; importing
pair: name; binding
- keyword: from
- keyword: as
+ pair: keyword; from
+ pair: keyword; as
exception: ImportError
single: , (comma); import statement
# exist, by deleting them when using the gettext builder.
pairindextypes.pop('module', None)
- # pairindextypes.pop('keyword', None)
+ pairindextypes.pop('keyword', None)
# pairindextypes.pop('operator', None)
# pairindextypes.pop('object', None)
# pairindextypes.pop('exception', None)