Book reviewUSENIX

 

Mark Lutz
Programming Python
O'Reilly & Associates, 1996. ISBN 1-56592-197-6. Pp. 880. Paperback. CD included.44.95

Reviewed by Terry Rooker
<trooker@illuminet.net>

Early in the 1990s the Python programming language inspired much enthusiasm. Here was a language that was easily ported across platforms. Even better, it allowed procedural, functional (as in Lisp), or object-oriented styles. It directly incorporated network programming features. Thus, much of the enthusiasm for Python was based on the ease with which GUI-based networked applications could be written for numerous platforms. All that was needed was a decent reference manual and training guide. Programming Python is that long anticipated reference and guide, all rolled into a single package.

The first part of the book covers a description of the general features of the language. Most importantly, it describes some of the unusual characteristics of Python. Although this section is not a comprehensive tutorial, it does provide enough information to help prospective Python programmers orient themselves. For example, Python can be used as a scripting language, it can be compiled into standalone applications, it can be embedded into programs written in other programming languages (or other Python programs), or it can be interpreted.

The second section covers fundamental parts of the language. It slowly develops a sample application. With each iteration the author adds some variation that describes an additional feature of the language. By working through these examples the reader learns how these features add power to the program.

The final section deals with producing final applications. Much of it is focused on developing a GUI for a front end to the application. It also discusses how Python can be extended by including functions from other languages as Python modules. It describes in more detail embedding Python in other applications. It pretty much covers the hard-core features needed to develop real applications.

The book succeeds in its goal. For anyone interested in learning to program with Python, Python Programming is a great resource. It is important to understand what it is. Normally, to support a programming language, you'd like to see a tutorial or other beginner's introduction, a detailed guide to advanced features of the language, and finally a comprehensive reference to the language. Unfortunately, Python never caught on widely, so it is difficult to support publication of several different books. For years the Python community has lived with documents available with the Python distribution: a short tutorial, some general documents, and programming reference. Although these documents are not entirely satisfactory, they have served a purpose. Probably most lacking has been a detailed guide to the language. Programming Python is that guide.

Because it serves as the detailed guide to provide programming help, the book is lacking in terms of introductory material and detailed descriptions of the built-in language functions. Although it is invaluable in terms of helping programmers build applications, it is less useful for someone interested in learning the language.

This problem is aggravated by the nature of the language itself. As I said previously, you can mix procedural, functional, and object-oriented styles. As a matter of fact, several developer friends of mine highly recommended Python specifically because it does allow a mixing of the styles. This book is no exception, with the examples showing how to mix the styles in many cases. For a developer looking for a rapid prototyping language, this may be less of a problem. In terms of software engineering principles, it is a disaster waiting to happen. I still have not decided if this is good or bad. Like most such dilemmas, it is probably a good things for expert programmers who can keep track of the differences and use each style appropriately. For the rest of us it may be more troubling. In either case the book could have pointed out some of these differences.

For a book trying to fill several niches, this single problem is not major. Overall, the presentation of material is well laid out, and the style is very readable. The name "Python" came from Monty Python's Flying Circus, and the author uses that theme in some of the presentation. Some of the chapter headings are inspired by skits and ideas from the British TV show, as are some of the programming examples. For someone who never watched the Monty Python show or saw the movies, these references can be confusing. Even though I was familiar with most of the references, I found them distracting because they sometimes appeared to be a forced attempt at being cute. Fortunately, there are few of them relative to the size of the book, and they don't distract from the overall presentation.

For anyone interested in the Python language this book is the best thing around. It may not be the best tutorial from which to learn the language, but any serious programmer will find the book invaluable. The problem is that Python may be overtaken by events in the networked software development environment. With the exception of its use as a scripting language, almost all the claims made for Python are also made for Java, and Java has a much wider base of support. So although Programming Python is an excellent book supporting an excellant language, that language may be relegated to a niche player. But if you want an alternative to Java, Python is a good choice, and this book is the perfect starting point.

 

?Need help? Use our Contacts page.
First posted: 13th May 1998 efc
Last changed: 13th May 1998 efc
Issue index
;login: index
USENIX home