Organization
This book has 20 chapters. Each chapter is devoted to a particular
kind of recipe, such as algorithms, text processing, databases, and
so on. The 1st edition had 17 chapters. There have been improvements
to Python, both language and library, and to the corpus of recipes
the Python community has posted to the cookbook site, that convinced
us to add three entirely new chapters: on the iterators and
generators introduced in Python 2.3; on Python's
support for time and money operations, both old and new; and on new,
advanced tools introduced in Python 2.2 and following releases
(custom descriptors, decorators, metaclasses). Each chapter contains
an introduction, written by an expert in the field, followed by
recipes selected from the online cookbook (in some casesabout
5% of this book's recipesa few new recipes
were specially written for this volume) and edited to fit the
book's formatting and style requirements. Alex (with
some help from Anna) did the vast majority of the
selectiondetermining which recipes from the first edition to
keep and update, and selecting new recipes to add, or merge with
others, from the nearly 1,000 available on the site (so, if a recipe
you posted to the cookbook site didn't get into this
printed edition, it's his
fault!). He also decided which subjects just had
to be covered and thus might need specially written
recipesalthough he couldn't manage to get
quite all of the specially written recipes he
wanted, so anything that's missing, and
wasn't on the cookbook site, might not be entirely
his fault.
Once the selection was complete, the work turned to editing the
recipes, and to merging multiple recipes, as well as incorporating
important contents from many significant comments posted about the
recipes. This proved to be quite a challenge, just as it had been for
the first edition, but even more so. The recipes varied widely in
their organization, level of completeness, and sophistication. With
over 300 authors involved, over 300 different
"voices" were included in the text.
We have striven to maintain a variety of styles to reflect the true
nature of this book, the book written by the entire Python community.
However, we edited each recipe, sometimes quite considerably, to make
it as accessible and useful as possible, ensuring enough uniformity
in structure and presentation to maximize the usability of the book
as a whole. Most recipes, both from the first edition and from the
online site, had to be updated, sometimes heavily, to take advantage
of new tools and better approaches developed since those recipes were
originally posted. We also carefully reconsidered (and slightly
altered) the ordering of chapters, and the placement and ordering of
recipes within chapters; our goal in this reordering was to maximize
the book's usefulness for both newcomers to Python
and seasoned veterans, and, also, for both readers tackling the book
sequentially, cover to cover, and ones just dipping in, in
"random access" fashion, to look
for help on some specific area.
While the book should thus definitely be accessible
"by hops and jumps," we
nevertheless believe a first sequential skim will amply repay the
modest time you, the reader, invest in it. On such a skim, skip every
recipe that you have trouble following or that is of no current
interest to you. Despite the skipping, you'll still
get a sense of how the whole book hangs together and of where certain
subjects are covered, which will stand you in good stead both for
later in-depth sequential reading, if that's your
choice, and for "random access"
reading. To further help you get a sense of what's
where in the book, here's a capsule summary of each
chapter's contents, and equally capsule bios of the
Python experts who were so kind as to take on the task of writing the
chapters'
"Introduction" sections.
- Chapter 1, introduction by Fred L. Drake, Jr.
-
This chapter contains recipes for manipulating text in a variety of
ways, including combining, filtering, and formatting strings,
substituting variables throughout a text document, and dealing with
Unicode.
Fred Drake is a member of the PythonLabs group, working on Python
development. A father of three, Fred is best known in the Python
community for single-handedly maintaining the official documentation.
Fred is a co-author of Python & XML
(O'Reilly).
- Chapter 2, introduction by Mark Lutz
-
This chapter presents techniques for working with data in files and
for manipulating files and directories within the filesystem,
including specific file formats and archive formats such as
tar and zip.
Mark Lutz is well known to most Python users as the most prolific
author of Python books, including Programming
Python, Python Pocket Reference, and
Learning Python (all from
O'Reilly), which he co-authored with David Ascher.
Mark is also a leading Python trainer, spreading the Python gospel
throughout the world.
- Chapter 3, introduction by Gustavo Niemeyer and Facundo Batista
-
This chapter (new in this edition) presents tools and techniques for
working with dates, times, decimal numbers, and some other
money-related issues.
Gustavo Niemeyer is the author of the third-party
<
|