3.8 Summary

3.8 Summary

In this chapter, we explored Python's basic procedural statements:

  • Assignments store references to objects.

  • Expressions call functions and methods .

  • print sends text to the standard output stream.

  • if/elif/else selects between one or more actions.

  • while/else loops repeat an action until a test proves false.

  • for/else loops step through the items in a sequence object.

  • break and continue jump around loops.

  • pass is an empty placeholder.

We also studied Python's syntax rules along the way, looked at Boolean operators and truth tests, and talked a little about some general programming concepts in Python.

By combining basic statements, we are able to code the basic logic needed to process objects. In Chapter 4, we move on to look at a set of additional statements used to write functions, which package statements for reuse. In later chapters, we'll see more statements that deal with bigger program units, as well as exceptions. Table 3.5 summarizes the statement sets we'll be studying in the remaining chapters of this part of the book.

Table  3.5. Preview: Other Statement Sets

Unit

Role

Functions

Procedural units

Modules

Code/data packages

Classes

New objects

Exceptions

Errors and special cases



Learning Python
Learning Python: Powerful Object-Oriented Programming
ISBN: 0596158068
EAN: 2147483647
Year: 1999
Pages: 156
Authors: Mark Lutz

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net