Computer programs are built with two essential features: data and processing. We started with processing elements of Python. We're about to start looking at data structures.
In Part I, “Language Basics”, we introduced almost all of the procedural elements of the Python language. We started with expressions, looking at the various operators and data types available. We described fourteen of the 21 statements that make up the Python language.
The Other Side of the Coin. The next chapters focus on adding various data types to the basic Python language. The subject of data representation and data structures is possibly the most profound part of computer programming. Most of the killer applications - email, the world wide web, relational databases, are basically programs to create, read and transmit complex data structures.
We will make extensive use of the object classes that are built-in to Python. This experience will help us design our own object classes in Part III, “Data + Processing = Objects”.
We'll work our way through the following data structures.
Sequences. In Chapter 11, Sequences: Strings, Tuples and Lists we'll extend our knowledge of data types to include an overview various kinds of sequences: strings, tuples and lists. Sequences are collections of objects accessed by their numeric position within the collection.
In Chapter 12, Strings we describe the
string subclass of sequence. The exercises
include some challenging string manipulations.
We describe fixed-length sequences, called
tuples in Chapter 13, Tuples.
In Chapter 14, Lists we describe the
variable-length sequence, called a list. This
list sequence is one of the powerful features that
sets Python apart from other programming languages. The exercises
at the end of the list section include both simple
and relatively sophisticated problems.
Mappings. In Chapter 15, Mappings and Dictionaries we describe mappings and
dictionary objects, called dicts. We'll show
how dictionaries are part of some advanced techniques for handling
arguments to functions. Mappings are collections of value objects
that are accessed by key objects.
Sets. We'll cover set objects in Chapter 16, Sets. Sets are simple collections of unique objects
with no additional kind of access.
Exceptions. We'll cover exception objects in Chapter 17, Exceptions. We'll also show the exception handling
statements, including try,
except, finally and
raise statements. Exceptions are both simple data
objects and events that control the execution of our
programs.
Iterables. The yield statement is a variation on return that simplifies certain kinds of generator algorithms that process or create create iterable data structures. We can iterate through almost any kind of data collection. We can also define our own unique or specialized iterations. We'll cover this in Chapter 18, Generators and the yield Statement.
Files. The subject of files is so vast, that we'll introduce file objects in Chapter 19, Files. Files are so centrally important that we'll return files in Part IV, “Components, Modules and Packages”. We'll look at several of the file-related modules in Chapter 33, File Handling Modules as well as Chapter 34, File Formats: CSV, Tab, XML, Logs and Others.
In Chapter 20, Advanced Sequences we describe more advanced sequence techniques, including multi-dimensional processing, additional sequence-processing functions, and sorting.
Deferred Topics. There are a few topics that need to be deferred until later. The class statement will be covered in detail in chapters on object oriented programming, starting with Part III, “Data + Processing = Objects”. We'll look at the with statement there, also. We'll revisit the import statement in detail in Part IV, “Components, Modules and Packages”. Additionally, we'll cover the exec statement in Chapter 28, Modules.
Table of Contents