Book Review: Foundations of Python Network Programming

I received a review copy of Brandon Rhodes’ Foundations of Python
Network Programming
from Apress a few weeks ago, but had to wait to
read it until my own book was complete. I finished reading it this
weekend, and it was worth the wait.

Quick Review

Inspired by Gene Ambaum and Bill Barnes’ review short-cuts, this is
my review for the impatient reader.

Why I picked it up: I know Brandon through PyATL and was
confident that his years of experience would ensure that he put out a
high quality book. He more than met my expectations.

Why I finished it: The conversational tone made it easy to zip
through the sections covering material I was familiar with, saving
more time to study the rest more completely.

I’d give it to: Any Python programmer who wants a better
understanding of the fundamentals of network programming. Even an
experienced Python programmer will learn a few new tricks from the
sections covering more modern tools like ZeroMQ and paramiko.


This is the second edition of Foundations of Python Network
. The first edition by John Goerzen was released in 2004,
and while a lot has changed in the way we use computer networks since
then the fundamentals remain constant. Brandon Rhodes has improved the
second edition by cleaning up the old examples that are still
relevant, updating or replacing the ones that became obsolete, and
adding new material. The results benefit from Brandon’s high level of
expertise and depth of knowledge in networking.

The book covers a broad range of topics, and is organized so that each
section builds on the knowledge of the previous chapters. The
discussions move from from raw TCP and UDP to encryption with TSL, and
then on to application protocols like HTTP, SMTP, POP, IMAP, and ssh.
Each section explains not just how to do a task, but why doing it
that way works.

The examples in the book are clear and illustrate the concepts
described in the text. There are a few places where the exposition
would benefit from a diagram or two (especially in the description of
TCP message windows), but the explanation given does stand on its own.

Every chapter of Foundations of Python Network Programming is filled
with practical advice. After establishing the fundamentals of
networking in the first few chapters, the book goes on to cover
architectural issues that come up when creating client server
applications. The different uses for RPC and message queue
architectures are covered, as well binary versus text wire protocols.
The latter chapters, which cover higher level protocols, discuss
best-of-breed libraries, removing much of the guesswork for Python
programmers choosing tools for new projects.


I recommend Foundations of Python Network Programming for
programmers who want to move beyond the usual web framework-based
development paradigm to learn more about what is going on behind the
scenes. It is concise, but written in a conversational style that
makes it easy to read. After reading the book, you will have a good
grounding in the fundamentals of networking and be introduced to many
more complex subjects. Brandon includes a number of references to
other sources of more information, as well, for readers who want to go
beyond the fundamentals covered here.

PyMOTW: The Book

I am excited to announce the impending release of The Python Standard
Library By Example
, a book based on my Python Module of the Week
blog series. The book presents selected examples from the blog, each
demonstrating how to use the most useful features of a module in the
Python standard library.

The manuscript is in the final production phase now, with an
anticipated release date in June 2011. A prerelease version is
available to subscribers of Safari Books Online through the Rough Cuts

More details…

Book Review: Practical Virtualization Solutions

Quick Review

My review for the impatient reader:

Why I picked it up: I have some basic knowledge of and experience
with VMware, but wanted learn more about Xen and Hyper-V.

Why I finished it: It reads quickly and provides a good grounding
in virtualization terms and technologies.

I’d give it to: Anyone looking into upgrading their infrastructure
using modern virtualization tools.


Practical Virtualization Solutions by Kenneth Hess and Amy Newman
covers a lot of ground. From basic introduction to the technology
itself, to advice about which of the big players to use now (and
to keep an eye on for the future), the authors walk you through all
the issues and potential gotchas of virtualization. Existing
virtualization users may find the early parts of the book a little
slow moving, but the advice in part 3 (“Hardware’s Role in
Virtualization”) looks at issues like I/O virtualization that most of
us haven’t seen before.

The most useful part of the book for me was chapter 2, which compared
the offerings from major virtualization vendors. The strengths and
weaknesses of the approach taken by each tool were explained, and the
authors give their advice, based on years of experience, about how to
decide which platform best fits your needs.

As part of the Negus Software Solutions Series, the book delivers
the promised hands-on experience in the remaining chapters of part 1,
where they give detailed procedures for setting up a virtual machine
and installing a guest operating system, using each tool in turn.
They go beyond the basic GUI instructions, too, as they dig into
implementation details like what the files in a virtual machine
definition contain. Each chapter ends with a real-world use case
showing how the tool helped an actual end-user.

Part 2 covers applications of virtualization for servers, desktops,
and network and storage resources. It is a good introduction to these
subjects, but not especially deep.

The third part of the book talks about hardware issues related to
virtualization. The authors emphasize the need to be realistic about
buying hardware to host your virtual servers, and include advice about
how to optimize your setup based on the hardware and software
compatibility between vendors.

They also discuss the tricky nature of network and I/O virtualization,
pointing out that adding more software to a part of the stack that is
already a bottleneck is unlikely to improve performance. They describe
the ways Vendors and OEMs are relying on hybrid solutions, with
special hardware and custom drivers, to obtain the best results.

Once you are convinced that virtualization is the right choice for
your setup, and you have done the work to select the appropriate tool,
you are ready for the planning advice in part 4. Beginning with tips
for justifying the move to a CTO or CFO, and then covering tools for
making the transition easier such as auto-discovery of services and
deployment automation, these final chapters reinforce and summarize
many of the tips from earlier chapters in the context of creating an
implementation plan.


I recommend this book for anyone considering getting into
virtualization who needs a comprehensive introduction. You’ll need
more detailed reference material once you select a tool, but
Practical Virtualization Solutions will give you the advice you need
to make that choice.

Disclaimer: I received a free review copy of this book from the
publisher as part of my participation in the CHUGALUG Book Club.

Book Review: Matplotlib for Python Developers

Matplotlib for Python Developers by Sandro Tosi is the latest in a
series of concise project-specific manuals from Packt. It covers
the matplotlib library for creating charts and graphs.

Quick Review

My review for the impatient reader:

Why I picked it up: I thought it might help with a project at work.

Why I finished it: I wanted to see what features matplotlib had
the could be useful, and how to integrate it with web frameworks.

I’d give it to: Anyone wishing to create custom charts and graphs,
especially pragmatically.


The book starts a little slowly, presenting lots of background
material and feature lists in chapter 1 without any real examples to
make them concrete. Chapter 1 also covers the installation process.
It’s a shame binary installers are required, and it isn’t clear
matplotlib and its dependencies work with tools like virtualenv. I
wish more publishers would move the installation instructions in these
sorts of books out of the first chapter and into an appendix, and let
the main content of the book focus on the primary subject matter.

The examples in chapters 2-4 start simple and build in complexity,
adding feature after feature. The progression is logical and it is
easy to skim over the repetitious parts of subsequent examples.
Having each chart style and annotation feature described will make the
book a good reference guide for someone using the library.

There were two minor issues with the presentation of the examples,
though. First, the author’s use of the non-standard IPython UI was a
little distracting, but it was explained in a later chapter that there
are some special interactive features of matplotlib which are best
used together with IPython. Second, the examples frequently use
“import as” to create abbreviated forms of module names. While it made
the code samples smaller, and may be how experienced matplotlib users
work, as a new user I found that it made the examples harder to
follow because I could not always tell where the functions were coming

The second half of the book includes three separate chapters covering
integration of matplotlib with different GUI toolkits, which felt a
little excessive. Since the same example application is presented, it
would have been less repetitious to see the chapters combined with
only the difference highlighted. The same comment applies to the three
sections on using matplotlib on the web. Using just one of the three
tools (CGI, Django, or Pylons) would have been sufficient, and left
space for more advanced examples or a deeper explanation.


My overall impression of the book is that it could make a useful
reference guide for matplotlib, but it didn’t have a lot of advice for
visualization issues in general. There are other more general books on
visualization techniques (including one from Packt), so the narrow
focus isn’t necessarily a problem if you are willing to look further.

Disclaimer: I received a free review copy of this book from the
publisher as part of my participation in the PyATL Book Club.

Book Review: Dive Into Python 3

I received a review copy of Mark Pilgrim’s updated `Dive Into Python
back in early November, but with the various holidays and
end-of-year activities I didn’t have a chance to read it until the
past week or so. I’m glad I waited until I had the time to sit down
and look over it carefully, because there is a lot of good material

Disclaimer: The review copy was free.

Quick Review

Inspired by Gene Ambaum and Bill Barnes’ review short-cuts, here’s
my review for the impatient reader:

Why I picked it up: Mark’s work has been the standard go-to guide
for learning Python for years now. I wanted to see what the new
version had to offer.

Why I finished it: No fluffy, contrived examples. Real-world code
and concise, clear discussion. And there’s no attempt to avoid
challenging topics.

I’d give it to: Beginner to intermediate programmers who want to
learn Python or improve their existing Python skills and experienced
programmers who want to learn about the new features of Python 3.

Completely Updated

Many of you may be familiar with, one of the
earliest major works published under an open license. The new edition
of the book has been updated to cover Python 3.1, including new
examples and entire new sections on language features not present in
earlier versions of the language. Starting with comprehensive setup
instructions to get Python installed, the introduction leaves no
excuses for not following along with the coding examples as you
read. It even includes advice for picking a text editor, in case you
don’t have one already.

Dives Right In

True to the title, the first code sample in Dive Into Python is a
complete program to convert integers to human-readable approximations
of different units. It uses I/O, dictionaries, functions (with
docstrings), new-style string formatting, and exceptions. On page 1.

Books about programming usually start with a bunch of boring
chapters about fundamentals and eventually work up to building
something useful. Let’s skip all that.

The more traditional discussion of integers, floats, strings, and data
structures is included early in the book, but that first example grabs
the attention better than the beginnings of many introductory texts.

Just the Facts

The explanation of that first program avoids fluff, staying on point
and addressing the reader as an intelligent learner. Striking that
balance between explaining the minutia of an example and letting the
reader discover the answer for themselves can be difficult, but Mark
finds it every time. This pattern is repeated throughout the book,
with each code sample being introduced, then examined in detail. Some
of the more important or interesting parts of the code are called out
for special discussion, as needed. And a few times sample code from
earlier in the book is reused in a later section. That code-reuse
reinforces the earlier point, while building on it to make the new

Real-world Advice

Throughout the book technical details about using Python (the language
and libraries) are mixed with solid developer advice on topics like
writing readable code, choosing tools, and getting the most out of
techniques such as testing. Chapter 14 covers HTTP web services, and
doesn’t stop with the basics of using httplib. In addition to talking
about third-party packages like httplib2, the chapter also stresses
the importance of creating well-behaved web clients and shows
techniques for doing so.

Beyond the Basics

The book also includes chapters on advanced topics such as porting
from Python 2 to Python 3 and packaging a library or application for
distribution. The porting chapter is actually a case study of porting
a real Python 2 library, chardet. It goes through the process of
running 2to3, and then works through examples of the conversion steps
that have to be done by hand. There’s a separate appendix with even
more detail about the types of automated translations 2to3 can make.

The more exotic your installation process is, the more exotic your
bug reports will be.

The packaging chapter stresses the need to follow standards and
conventions to make distributing your code easier – both for yourself
and and for your users. It covers the details of using distutils and
PyPI, licensing, and building source and binary distributions.


I can recommend Dive Into Python for any beginner or intermediate
programmer with a desire to pick up Python from scratch, or improve
their existing Python skills. More experienced programmers will find
the first few chapters fairly light reading, but the chapters on HTTP,
XML, and other advanced topics in the rest of the book helpful.

The porting and packaging chapters were of special interest to me.
This is starting to look like the year we should all be porting our
libraries to Python 3, so I imagine I’ll be re-reading the material on
2to3 a few times over the next few weeks.

Book Review: Citizen Engineer

Disclosure: I received a copy of this book for free from the
publisher as part of the PyATL Book Club.

The goal of Citizen Engineer, from Prentice Hall/Pearson Education,
is to awaken the socially responsible engineer in each of us. The
topics covered range from the environmental impact of product design
to the sociopolitical ramifications of intellectual property
law. Authors David Douglas (Senior VP of Cloud Computing, Sun), Greg
Papadopoulos (CTO and Executive VP of R&D, Sun), and John Boutelle
(freelance writer) share their experience in all of these areas to
create a thought-provoking introductory guide to the issues of modern
engineering practice.

Citizen Engineers are techno-responsible, environmentally
responsible, economically responsible, socially responsible
participants in the engineering community.

The authors begin by covering the background of what they call the
“Citizen Engineer” and why the issues are important. The premise of
the book is that it is no longer sufficient for engineers to work in
isolation in their labs. We must engage with practitioners of other
disciplines to bridge the gap between science and society. This is not
a new responsibility, and the role of “citizen engineer” is not new.
However, it is expanding as engineers have an ever greater need to
understand a broader range of fields to do their job well. Even if the
engineer doesn’t practice intellectual property law or environmental
science, they need to be familiar with the issues involved in order to
collaborate effectively.

They start the discussion by listing several external driving forces
that are changing the economics of the way good engineering is being
done. These include the environment, corporate social responsibility,
fraud and security concerns, privacy, digital goods and intellectual
property issues, and government regulation in all of those areas. The
book touches on each of these areas in turn.

Engineers who were once preoccupied with Moore’s Law are now dealing
with more laws…

Part 2 of the book is devoted to environmental issues and making the
case that the environment is something engineers can, should, and are
thinking about. Environmental impact analysis is complicated by many
variables and the fact that reducing impact in one area can increase it
in others. The authors approach the problem pragmatically. They start by
prioritizing changes based on the biggest impact, and ensuring that
impact is studied over the full life-cycle of the product. They also
point out that sustainability issues need to be considered “at scale” to
expose the true impact of small changes. For example, billions of people
use consumer products such as light bulbs, meaning even seemingly tiny
incremental improvements in efficiency or sustainability can have
sweeping global impact in energy consumption, materials used, and
natural resources consumed. Even a change to reduce the packaging weight
of a product will reduce the amount of fuel needed for shipping and
distribution, and depending on the scale that impact can be as big or
bigger than a change directly to the product itself.

… IT equipment often consumes less than half the power used in a
typical data center.

A little closer to home, the authors refer to research that says less
than half of the power used by a typical data center goes into
computing. The rest is lost as heat waste in the conversion to different
power levels, or is used to keep the computers cool. There is research
being done into more efficient cooling techniques, consolidation of
systems through virtualization, and alternative power setups with higher
voltage. Changing the hardware is not the only path to reducing power
consumption, though. More efficient code, and more efficient execution
of that code, provides opportunities for using less hardware in the
first place. That’s food for thought the next time you put off
optimization by saying, “cycles are cheap”.

Intellectual property laws are crafted to protect inventors and
creators and the companies that market their works.

Part 3 is titled “Intellectual Responsibility” and covers the
fundamentals of intellectual property law, including copyright,
trademark, and patents. I found the definitions of the IP terms such as
patent, copyright, and trademark in this section particularly helpful
for clarifying the roles each of those tools has in IP generally and
software specifically. I also like the way the authors separated the
technical background material from their own opinions on the subject.
Not everyone will agree with all of their conclusions, but the
delineation between fact and opinion avoids clouding the issue.

Chapter 13 digs into the basic types of open source licenses and the
decisions a software developer needs to make when deciding how to
license their creations. They also talk about forms of open licenses
for non-software products, such as Creative Commons. The authors have
copyrighted their book under a Creative Commons license (BY-NC-SA
3.0), and have downloadable copies of chapters available online at

The final section of the book, “Bringing it to Life”, talks about how
to apply some of the ideas from earlier chapters immediately, as well
as changes that are being made in engineering training so responsible
engineering practices are more central in future work. They talk about
cross-discipline training in law and environmental science and the
curriculum changes being tested in major universities. The book then
wraps up with examples from a selection of success stories from around
the world.

I recommend Citizen Engineer for engineers from all fields who
want a better understanding of some of the issues that are driving
changes in engineering practices. The clear and concise writing style
makes the book an easy read, without glossing over any difficult
topics. It does not attempt to provide an exhaustive reference
manual, but does give plenty of other resources for future research
and reading.

Book Review: The Success of Open Source

For the past few weeks I’ve been wrapped up reading Steven Weber’s
The Success of Open Source. Published in 2004, it is a look at what
the open source movement is and how it works, from the perspective of a
political scientist. This is no trite look at why people would choose to
give away the fruits of their labor. His analysis is serious and well
considered. He stresses several times that his goal is to ask questions
rather than answer them, but he does offer some observations about the
open source movement as a larger social movement and how it might spread
to other parts of the culture.

Weber starts out by explaining his goal for the book, to study the
political and economic foundations of open source communities and
processes. He makes two assertions, around which the rest of the book is

1. The open source phenomenon is an important “puzzle” for social
scientists who study cooperation.
2. OSS communities have been fundamentally impacted by the internet.

Early History

The second chapter covers the basic facts of the early history of open
source, well before it was called that. From the PACT compiler project
for IBM mainframes, through the failure of Multics, and the unintended
consequence of the AT&T consent decree that lead to the original
licensing terms for Unix, he covers some details that aren’t a part of
the usual story that includes DARPA, BSD, the fragmentation of the Unix
market, and FSF and the GNU project. The writing is engaging, and I
could recommend the book on this history section alone.

How Does OSS Work?

Chapter 3 tries to answer the question, “What is Open Source and How
Does It Work?”. It covers some essential software project
characteristics such as the division of labor between “analyst” and
“programmer” and how that historically lead to problems because the
designer of software was too far removed from the end-user.

The essence of software design, like the writing of poetry, is a
creative process. The role of technology and organization is to
liberate that creativity to the greatest extent possible and to
facilitate its translation into working code. Neither new technology
nor a “better” division of labor can replace the creative essence
that drives the project.

Weber builds on Brooke’s Law to say that success of a project isn’t
just about getting more people involved, but also about how they are
organized. He points out that open source is much more about the
process than the resulting product, which is an artifact of the
organization and creative energies of the participants. He identifies
four fundamental organization schemes that repeat in open source

1. A hierarchy, where patches flow up to a more or less central
maintainer, as with Linux.
2. The concentric circles used by the BSD project, in which
maintainers closer to the center have more rights and privileges, but
within a circle they are essentially equal.
3. The pumpkin holder or token-based system used by the developers
of Perl.
4. A democratic voting system, such as used to approve changes in

One assertion Weber makes relates to the different cultures that
evolve around BSD vs. GPL-licensed projects. His claim is that core
developers in BSD-licensed projects do not depend as much on submissions
from the end user as GPL projects do. His evidence for this is the
various BSD operating systems and Linux. I think his sample size is too
small, though. I’m not convinced that the license has much to do with
“dependence” on contributions. I think the attitude of the core
developers, and their willingness to accept patches, is more important.

Evolution of Open Source

Chapter four talks about the “maturation” of three major projects
(Linux, BSD, and Apache) as they evolved in the 1990’s, the “golden age”
of open source. He covers several pivotal events during that period and
how the community identities gelled as a result of passing through
critical times like the fracturing of BSD and other Unixes, flame wars
and other crises among the Linux maintainers, and the conflict caused by
the “ideological passion” of Richard Stallman and the FSF. This chapter
was an interesting retrospective and it really pulled together a
cohesive picture of what happened that brought us to where we are today.

Motivation and Organization

Chapter five examines the microfoundations of open source made up of
the motivations of individual contributors. For example, he says that
open source developers self-select as a way to boost their egos by using
acceptance of their code as a “signal” of its quality to developers who
are not necessarily skilled enough to recognize quality on their own.

It is clearly the best programmers who have the strongest incentive
to show others just how good they are. If you are mediocre, the last
thing you want is for people to see your source code.

Ego boosting is one of 6 motivating factors he discusses, and is not
necessarily the most important for most developers.

Chapter six looks at how individual developers come together to form
groups and focus their creative energies with constructive
contributions. He studies the social and economic pressures for and
against forking a project, and comes to an interesting conclusion: The
leader of a project needs the fellow contributors more than they need
him. When a fork is created, the new leader has to convince potential
followers that the new project will be better or more popular than the
old one. So while forking may give the leader more visibility, that
only works if he is successful at attracting followers, in which case he
is just as likely to be a successful contributor to the original

The Code That Changed The World

Weber begins his final chapter by comparing the impact of OSS to the
Japanese manufacturing innovations described in The Machine That
Changed the World : The Story of Lean Production
and re-emphasizing
the importance of process over product.

The Toyota “system” was not a car, and it was not uniquely Japanese.
… Open source is not a piece of software, and it is not unique to
a group of hackers.

This leads in to the rest of the conclusion, where he brings together
observations on intellectual property rights law, the limiting factors
for specialization and division of labor and how they impact
organizational structures, and the challenges of relating hierarchical
versus network organizations. He also offers some observations about how
open source techniques and attitudes can be applied directly in other
fields such as family practice medicine and genomics.


Weber covers a lot of material, and his writing is clear, for the most
part (especially for an academic :-). I enjoyed reading the first seven
chapters, but got a little bogged down in the chapter eight. I was
disappointed at his reluctance to draw more definite conclusions in a
few cases, but by remaining neutral he was able to focus on framing
several thought-provoking social and economic questions about the open
source movement.

Book Review: Python Essential Reference, Fourth Edition

Disclosure: I received a copy of this book for free from
Addison-Wesley as part of the PyATL Book Club.

I have a copy of the first edition of the Python Essential
that I picked up at IPC 8 back in 2000. It’s largely out of
date by now, given that it covered Python 1.5.2. But at the time it was
one of the few books I always kept close at hand for easy reference.
Over time my reference habits evolved away from paper references in
favor of online materials. Today I cleared a little space on my desk
for the fourth edition of PER by David Beazley, updated to cover Python
2.6 and 3.0.

Pound for pound

Just a little space, mind you, because the book is quite compact (717
pages in 6” x 9” x 1”, easily portable in a backpack or briefcase). This
book, diminutive though it may be, has more information of direct use to
Python programmers than many of the War and Peace-sized tomes you’ll
find elsewhere. If David keeps adding material at this rate, I’m going
to need a magnifying glass for the next edition.

The book is organized into three main sections: Language, Library, and
Extending and Embedding. There is a comprehensive index and the chapter
sequence places related information close together. You will not find
yourself flipping back and forth between an early “prose” chapter to a
later “reference” section.


The language section can serve as a reference guide for Python, though
I think the first chapter title “Tutorial” is a little optimistic
based on the brevity. To be fair, the preface states right up front
that the book is not intended to be an introductory text.

This is not a book for learning Python. It is a book for writing


The coverage of the standard library is where PER really shines. I
have a certain amount of interest in documenting the Python
standard library myself, so I was especially keen to review the
material here. I found it up to date, clearly explained, and
detailed. There is not a lot of sample code, but it is not entirely
devoid of examples. In most cases, the prose descriptions are
sufficient and eliminating code samples let David maintain a readable
style without adding filler material.

I thought I had internalized most of this material long ago, but I
learned a few things by re-reading it.

As the title implies, this is not an exhaustive reference guide. It
covers the essential information that will be useful to the most
readers. As a result, some of the modules are covered in less depth than
others. However, I tend to agree with where focus is placed. For
example, much more space is given to working with sqlite3 and databases
in general than some of the more esoteric modules like dis. The ast
module doesn’t appear at all.

Extending and Embedding

The Extending and Embedding section is one area where plenty of
example code is provided. Three techniques for creating extension
modules are covered: hand coding, ctypes, and SWIG (no surprise, since
SWIG is popular and was written by the author). Examples and commentary
are provided for all three approaches.

Going the other direction, embedding an interpreter in another
application, is also explained. All of the functions from the Python
library useful to someone trying to make their application scriptable
are listed and described, with some basic examples showing how to
communicate between the interpreter and your main application.


Due to the reference style, this should not be your first Python book.
It should absolutely be your second.

Book Review: The Practice of Programming

The Practice of Programming by Brian Kernighan and Rob Pike left me
a little disappointed. If I had read it at a time closer to when it was
originally published in 1999, I may have come away liking the book
better. There’s nothing wrong with the advice, and it reads well, but I
don’t think the examples are standing the test of time.

It is also possible that I’m just not a good representative of the
target audience. The book focuses a lot on C, C++, and Java, with most
of the examples in C. By 1999 I had moved over to mostly Python
development and wasn’t doing the sort of low-level coding in C that may
have made their examples more appealing.

This book is about the practice of programming – how to write
programs for real.

The sections that talk about the the social aspects of programming are
still valuable advice. For example, The code style issues and
recommendations in chapter 1 can apply to any language, and basically
boil down to write simple code meant to be read by another human being.
I agree with their premise that clear code is also frequently the most
optimal for runtime performance.

Chapter two talks about data structures and algorithms and covers a
simple implementation of quicksort. The explanation is good, but on
the other hand, does anyone still need to write their own sort
functions? Do we really not have any other algorithms that are complex
enough to be interesting, common enough to be worth reading about, and
understood well enough that we can analyze them? I found that
Beautiful Code (O’Reilly) had more interesting examples.

The Markov chain generator in chapter three did remind me of some code
I wrote in 1998 (in Python) to find phrases in a Framemaker document
that might be worth adding to the index. Maybe I should recreate some of
that code for Sphinx.

I skimmed over a lot of the performance section since it seemed
focused on low level C code and I try to avoid the sorts of situations
where I would need to implement my own version of strstr() just to
create a spam filter. This was another example of the text being dated.

I think the only real disagreement I had with anything they said was
in the section on debugging and error handling, where the authors
suggest saving exceptions for “truly exceptional” situations and don’t
think failing to open a file qualifies. I see two problems with this
position: First, failing to raise an exception means there are two error
reporting channels that need to be handled separately. Second, low-level
code would have to check for all error conditions instead of allowing
the exception to bubble up. Moving all error reporting to exceptions
means that low-level code is more streamlined (and easier to read)
because it doesn’t have to consider error handling unless it can work
around the problem (creating a missing file, for example). Maybe the
advice is based on bad exception support in C++/Java? Or maybe their
selected example is just not good. Searching for a substring may have
been a better choice for an example, since the missing value isn’t
actually an error.

If you’re new to professional programming, this book might be useful.
If you have some real-world experience under your belt, you will find
the same advice elsewhere in a more modern form. This book does talk
about “how to write programs for real”, just not the sorts of programs I
have ended up writing.

Book Review: IronPython in Action

IronPython in Action by Michael Foord and Christian Muirhead
covers the version of Python built to run on Microsoft’s CLR and
explains how to use it with the .NET framework.

Disclaimer: I received a review copy of this book from Manning
through the PyATL Book Club.

There are two target audiences for this book: experienced Python
developers wanting to learn .NET, and experienced .NET developers
wanting to learn Python. Both groups will find plenty of interesting
material and learn a lot. After some relatively basic introductory
chapters, the authors dig right in building a complex GUI application,
and then implementing a web interface for the same desktop application.

Along the way they introduce topics such as different programming
models in Python, navigating the MSDN documentation (very important for
understanding the scope of features available in .NET), packaging your
app for distribution under Windows, data persistence, XML parsing,
design patterns, automated testing, system administration, relational
databases, and two separate GUI libraries.

All of the code is clear, concise, and useful – there are no fluffy,
throw-away code snippets that fall short in the real world. While many
of the examples given are specific to IronPython or .NET, the techniques
being illustrated are definitely not.

I recommend this book for any Windows developer interested in learning
about Python, and for Python developers looking into deploying an
application under Windows. If you don’t fall into either of those
groups, I can still recommend that you pick up a copy for some excellent
advice on general programming topics and the solid example code.