Programming Python, 2nd edition

Programming Python, 2'nd edition, Mark Lutz, O'Reilly, 2001, 1255 pages + CD-ROM.

This book is a work of art. I have read all 1255 pages and yet still I come back to them and treasure them. I did not read the book straight through; rather I read large sections at a time, but out of order, going where my interests took me. But the book is meant to be read straight through, and is written well enough to maintain interest when read in that manner. Printed on high quality paper with a beautiful and sturdy binding, this book will be a well-worn reference book in my library ten years from now.

The book takes up where "Learning Python" leaves off, and makes a perfect book to read immediately after absorbing "Learning Python." In fact, if I could own only two Python books, these would be the two. Programming Python is really the equivalent of three complete and worthwhile books all by itself.

Mr. Lutz put a lot of thought into each page. The book is about code, and he gives us a copious amount in each chapter. Many of the example scripts and programs build on one another from chapter to chapter, which helps to give the book a narrative flavor and hold the reader's attention. The sample programs are of such a high quality that I am sure I will be using several of them as stand-alone utilities and mini-applications in the coming months. Moreover, some of them are perfect for re-use in my own programs. Programming in such a way as to make code re-use easy is a major theme of the book.

Of all the sample programs, my own favorites, at this time, are a set of programs called and its relatives. allows a novice user to easily and painlessly launch any or all of the sample scripts in the book, with merely the click of a button. This script is perfect to be re-used in distributing one's own programs and scripts.

The first section of the book covers System Tools, including the sys and os modules, and goes into some depth covering the use of these tools to work with the operating system shells, directories, and files. Next, Mr. Lutz goes into an in-depth look into threads, forks, pipes, and signals. I have not seen these topics written about as lucently and in similar depth, anywhere else. Several useful utility scripts are developed in this section.

The next major section is on GUI programming with Tkinter. At almost 250 pages, this section is equivalent to a stand alone book on the subject; and I must confess that I actually prefer this treatment of the subject to Grayson's book. If you are interested in Tkinter, then this material is highly recommended; and even if you are not, it is well worth reading.

Next, there is a major section devoted to internet and network programming. This is my favorite part of the book. Mr. Lutz does a stellar job of explaining sockets and low-level network plumbing, and how to program them using Python. Although I may never personally use the socket level material in my own programming, I feel truly enriched by having absorbed this coverage.

Moving on to client side scripting, several great example programs are developed and discussed, mostly having to do with processing email. Then, on the server side, Mr. Lutz gives a fairly detailed explanation of Python CGI programming. Finally, this section covers various "advanced" internet topics, including Zope, Jython and XML, but not in the same depth as previous topics.

Moving on to the next major section, we read in detail about DBM files, pickle, shelve, and SQL databases; data structures such as stacks and sets; and then a chapter on text processing including regular expressions.

Lastly, there is a major section on extending and embedding Python using C and C++.

Mr. Lutz concludes with some intelligent speculation on the future of programming, programming languages, and Python. Needless to say, I found these musings to be fascinating and insightful.

At $55, this book is a bargain. No where else will you find as much depth of good information, and it is put together in a quality package from the snake on the front cover to the Colophon in the back which explains that the snake on the front cover is an African Rock Python, and gives details including certain mating habits of the species.

I heartily recommend that you purchase this book.