Book Review: Python Standard Library
When I offered to review Python Standard Library, I expected to find a dull list of library functions with dry descriptions of their arguments. I was pleasantly surprised, though, when I started reading the book. The author claims to spend hundreds of hours answering questions on the comp.lang.python Usenet newsgroup. It shows.
Rather than the dry manual I expected, this book is filled with useful examples. It is comprehensive, with the exception of not covering Tkinter. This seems like a reasonable decision considering that the majority of Python users will not use Tkinter, and it would take a lot of space to document. In fact, Fredrik is working on a separate book on Tkinter.
Python Standard Library is divided into 14 chapters, each covering a related set of modules. As the book is comprehensive there is no reason to enumerate its contents here, but the divisions are quite logical. For example, there are chapters on threads and processes as well as mail and news message processing. Two chapters, "Platform-Specific Modules" and "Implementation Support Modules", cover the non-generic modules.
To give you a feeling for the book, I will describe two specific sections in detail.
The first section is called "The string Module", from the "Core Modules" chapter. This section is a little under two pages, the majority of which is code. After a once-sentence description, you are presented with an example. The example includes the file name (so you can find it on the CD), about ten lines of code and the result of executing the code. The code is mainly print statements with a text string passed to the various functions of string, e.g., string.upper, string.lower, string.split, string.count.
Next comes a brief description of differences between Python 1.5.2 and later versions. As the main difference is the availability of string methods in the later versions of Python, a new example is included that shows the same code written to use string methods instead of string module functions.
A third description and example explains the additional capabilities of the string module for converting other data types to strings. The final paragraphs describe how you can use the int and float functions as an alternative to the string module counterparts.
As a second example, I have selected "The cgi Modules" from the "Network Protocols" chapter. This description is about 1.5 pages long and includes two short paragraphs of text, followed by a listing. The listing is a CGI script that returns a list of files in a specified directory. It uses os.environ.get to grab the QUERY_STRING, os.listdir to get the file names and cgi.escape to clean up strings.
While the example is cleanly written and does what it says it should, I was a little disappointed that it did not go into all the functionality of the cgi module. For example, it mentions that the module can parse CGI form data, but there is no description or example of how to do this.
The CD is a logical addition, it includes all the scripts found in the book. In addition, it contains prebuilt Python 2.0 distributions for Windows and x86 Linux (in RPM format), plus a demo copy of PythonWorks Pro 1.2 for the same two platforms.
PythonWorks is an integrated development environment (IDE) for Python. The included software runs in demo mode, limiting what you can do with the included projects. However, you can get a free, time-limited Evaluation Ticket from the Pythonware web site, so you can see how it runs on your project.
Overall, the book is packed with a lot of practical information. The text seems accurate--the only typo I found was grammatical and insignificant. It doesn't answer every question readers might have, but for its size and readability it does a good job. Unlike some books I have seen on other programming languages--where readers are handed a lot of code but figuring out what it does and what it is related to is left to them--I found all the examples in this book relevant to the subjects being addressed.
As long as you don't expect to find everything in one book, I expect you will be satisfied. If, however, you just must have all the information in one book, the Python Developer's Handbook (reviewed in the February 2001 issue of Linux Journal) may be the better choice.
Phil Hughes is the publisher of Linux Journal.
|Nativ Disc||Sep 23, 2016|
|Android Browser Security--What You Haven't Been Told||Sep 22, 2016|
|The Many Paths to a Solution||Sep 21, 2016|
|Synopsys' Coverity||Sep 20, 2016|
|Naztech's Roadstar 5 Car Charger||Sep 16, 2016|
|RPi-Powered pi-topCEED Makes the Case as a Low-Cost Modular Learning Desktop||Sep 15, 2016|
- Android Browser Security--What You Haven't Been Told
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Nativ Disc
- The Many Paths to a Solution
- Naztech's Roadstar 5 Car Charger
- Synopsys' Coverity
- Securing the Programmer
- RPi-Powered pi-topCEED Makes the Case as a Low-Cost Modular Learning Desktop
- Identity: Our Last Stand
- Glass Padding
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide