Next / Previous / Contents / TCC Help System / NM Tech homepage

22. Simple statements

Python statement types are divided into two groups. Simple statements, that are executed sequentially and do not affect the flow of control, are described first. Compound statements, which may affect the sequence of execution, are discussed in Section 23, “Compound statements”.

Here, for your convenience, is a table of all the Python statement types, and the sections where they are described. The first one, the assignment statement, does not have an initial keyword: an assignment statement is a statement of the form “variable = expression”.

Assignment Section 22.1, “The assignment statement: name = expression.
assert Section 22.2, “The assert statement: Verify preconditions”.
break Section 23.2, “The break statement: Exit a for or while loop”.
continue Section 23.3, “The continue statement: Jump to the next cycle of a for or while.
del Section 22.3, “The del statement: Delete a name or part of a value”.
elif Section 23.5, “The if statement: Conditional execution” and Section 23.8, “The try statement: Anticipate exceptions”.
else Section 23.5, “The if statement: Conditional execution”.
except Section 23.8, “The try statement: Anticipate exceptions”.
exec Section 22.4, “The exec statement: Execute Python source code”.
finally Section 23.8, “The try statement: Anticipate exceptions”.
for Section 23.4, “The for statement: Iteration over a sequence”.
from Section 22.6, “The import statement: Use a module”.
global Section 22.5, “The global statement: Declare access to a global name”.
if Section 23.5, “The if statement: Conditional execution”.
import Section 22.6, “The import statement: Use a module”.
pass Section 22.7, “The pass statement: Do nothing”.
print Section 22.8, “The print statement: Display output values”.
raise Section 23.6, “The raise statement: Cause an exception”.
return Section 23.7, “The return statement: Exit a function or method”.
try Section 23.8, “The try statement: Anticipate exceptions”.
yield Section 23.10, “The yield statement: Generate one result from a generator”.