After reading only the first three chapters, the reader will begin to understand why Python is rapidly becoming the language of choice for many programmers.
Authors: Aaron Watters, Guido van Rossum, James C. Ahlstrom
Publisher: M&T Books
URL: http://www.mandt.com/
Price: $34.95
ISBN: 1-55851-484-8
Reviewer: Dwight Johnson
Internet Programming with Python is a book to teach Python programming to intermediate and advanced programmers.
Authors Watters, van Rossum and Ahlstrom are well qualified to write about their subject: van Rossum is the primary author of the Python language; Watters works for AT&T Laboratories on exploratory Internet applications; Ahlstrom is the original author of the WPY/Python GUI package. All three authors can be found actively contributing to the Python mailing list and the comp.lang.python newsgroup.
Chapter One briefly describes the strengths and weaknesses of Python. As Python is a dynamically typed, object oriented, general purpose language built from a small number of constructs, it is both powerful and easy to learn and use. Because it is interpreted, it is suitable for rapid prototyping and program development. Because it easily incorporates modules written in other languages, it is an excellent glue language for the overall structure of large programming projects. Python is not suitable for programming algorithms which require very rapid or time critical execution such as data compression, device drivers, complex floating point calculations or complex database operations.
Chapter Two gives a birds-eye view of Python and Chapter Three is a fun and humorous hands-on tutorial which gives the reader some experience working with actual Python constructs and code.
Chapters Four, Five and Six present the Python language in a more formal and systematic way. The authors recommend these chapters for later reference rather than for detailed reading. Although these chapters are quite complete, they are not intended to replace the reference manual that comes with the Python distribution.
To illustrate the virtues of programming in Python, Chapters Seven, Eight and Nine introduce three of the most abstruse applications of Internet programming—the dynamic generation of HTML documents, CGI programming, and programming Internet protocols—and show how Python easily and elegantly deals with the programming issues involved.
The authors are teachers at heart and take pains to briefly and lucidly explain each of these applications before delving into their Python solutions—solutions which illustrate and justify some of Python's most powerful features: multiple inheritance, dynamic attribute access, dynamic keyword arguments and use of the extensive Python tools, libraries, modules and demos that come with the Python distribution.
Python's object-oriented features make it a convenient language for implementing a graphical user interface. Chapter Ten introduces Tkinter and WPY, two class libraries developed for that purpose, and goes on to use WPY to develop a very interesting HTML viewer application that could very easily be enhanced to become a simple web browser.
Chapter Eleven is an introduction to writing C language extensions which can be used to add new basic functionality to Python. According to the authors, “Extending Python is easy, so easy in fact that playing with Python extensions might be an excellent way to learn the C programming language...” They illustrate extending Python with an example called BStream that has the practical application of conveniently manipulating large images.
Python can be embedded as a component of another main program. As an example, Chapter Twelve shows how to embed Python under any Netscape HTTP Server product that supports the NSAPI server component API. This might be useful to provide dynamic CGI server functionality to a web server without the overhead of running separate CGI processes for each request.
Appendices give a brief guide to the Python standard libraries and a very useful tutorial on regular expressions.
Internet Programming with Python comes with a handy CD-ROM which includes the complete 1.3 and 1.4b2 versions of Python as well as source code for all the Python examples given in the book. Executable versions are included for DOS, Windows 3.1, 95 and NT, Macintosh and all of the popular Unix platforms, including Linux.
Overall, Internet Programming with Python is an outstanding read. The discursive portions of the book alone, in sections such as “How CGI Works,” are well worth the effort.
Authors Watters, van Rossum and Ahlstrom write with wit and wisdom. They demonstrate a genuine knack for making complex subjects easy. They gently introduce the reader to the nuts and bolts of the Python language. At the same time, they consistently stay with their secondary theme by drawing all of their examples from Internet programming. And they clearly explain the application of Internet programming as they go.
The single negative is that there are a disturbingly large number of errors in the text and examples. Corrections to these have been published on the Python web site at http://www.python.org/. I strongly urge any reader who is not an experienced programmer to get and apply these corrections before reading the book.
With that single caveat, anyone interested in programming should read Internet Programming with Python.
As Internet Programming with Python amply proves, Python is a general purpose programming language which, because of its advanced features, easy extensibility and ability to incorporate modules from other programming languages, is an ideal first programming language that will greatly simplify and accelerate the development of many applications of arbitrary complexity.
After reading only the first three chapters, the reader will begin to understand why Python is rapidly becoming the language of choice for many programmers.
As Python is included in most Linux distributions, and some, such as Red Hat, make extensive use of Python in the systems administration tools they provide, Internet Programming with Python should be on the bookshelf of every Linux user.