Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
I introduced Python’s syntax model in Chapter 10. Now that we’re stepping up
to larger statements like the if,
this section reviews and expands on the syntax ideas introduced
earlier. In general, Python has a simple, statement-based syntax.
However, there are a few properties you need to know about:
Statements execute one after
another, until you say otherwise. Python normally runs
statements in a file or nested block in order from first to last,
but statements like if (and, as
you’ll see, loops) cause the interpreter to jump around in your
code. Because Python’s path through a program is called the
control flow, statements such as if that affect it are often called
control-flow statements.