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

15. 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 16, “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 15.1, “The assignment statement: name = expression.
assert Section 15.2, “The assert statement: Verify preconditions”.
break Section 16.2, “The break statement: Exit a for or while loop”.
continue Section 16.3, “The continue statement: Jump to the next cycle of a for or while.
del Section 15.3, “The del statement: Delete a name or part of a value”.
elif Section 16.5, “The if statement: Conditional execution” and Section 16.8, “The try statement: Anticipate exceptions”.
else Section 16.5, “The if statement: Conditional execution”.
except Section 16.8, “The try statement: Anticipate exceptions”.
exec Section 15.4, “The exec statement: Execute Python source code”.
finally Section 16.8, “The try statement: Anticipate exceptions”.
for Section 16.4, “The for statement: Iteration over a sequence”.
from Section 15.6, “The import statement: Use a module”.
global Section 15.5, “The global statement: Declare access to a global name”.
if Section 16.5, “The if statement: Conditional execution”.
import Section 15.6, “The import statement: Use a module”.
pass Section 15.7, “The pass statement: Do nothing”.
print Section 15.8, “The print statement: Display output values”.
raise Section 16.6, “The raise statement: Cause an exception”.
return Section 16.7, “The return statement: Exit a function or method”.
try Section 16.8, “The try statement: Anticipate exceptions”.
yield Section 16.9, “The yield statement: Generate one result from a generator”.