29 of 29 people found the following review helpful
Ryan M. Balfanz
- Published on Amazon.com
If you have ever worked with Python, you have probably come across Python Module of the Week (PyMOTW) or virtualenvwrapper. Both are the work of Doug Hellmann. He has now brought to life The Python Standard Library By Example. If Python gives you the batteries, Hellmann gives you not only an instruction manual but the "on" switch to get you going right away.
The Python documentation is really great, but might leave some with a "some assembly required" feeling. The book's examples aim to be more complete, while still covering a serious breadth of the Standard Library. Do not expect to use all of the examples in your project without some modification, customization and expansion. After all, they are miniature projects in their own right.
By the Numbers:
It weighs in at a whopping 1300-something pages across 19 chapters. This translates roughly to a 2-inch print copy, or a 7.3 MB PDF. The accompanying source is 5.5 MB after unzipping and contains 113 example modules. The examples were tested with Python 2.7. Some of the examples would port to Python 3 easily, others not so much. Even before reading it, I was pretty impressed and somewhat reluctant. Some of those numbers might not be very meaningful as far as the book's usefulness, but it should give you a sense of how much material is covered. In my opinion, you get a lot for the price.
What I Thought:
I use Python as my primary language and I admit that I had never heard of some of the modules covered (e.g. anydbm, asyncchat, pyclbr, just to name a few). Not only that, the modules which I had previously used were probably in the minority and smaller still are the modules which I use regularly. This is in part due to changes made in Python 2.7 that I have not absorbed, but also because there are plenty of places for cool features to hide out if you are not looking for them. I can say that after being exposed to the material, I have a better understanding of some of the most common modules and have added a few others to my arsenal.
I would recommend this book to any serious Python programmer who wants to get the most of what Python has to offer. If you are just starting with Python, but comfortable with another language, you might pick up quite a bit from just a quick skim of everything. You can then drill down into the parts which seem most applicable or interesting. However, if you are new to programming, this is probably not the book for you (as mentioned in the book's Introduction, and several other reviews I found).
I received an electronic review copy from the publisher in exchange for my review. The past two or three days my home internet has been down. This book was great to have around in a time of crisis. But due to the nature of the material I think I would personally make more use of it as a hard copy. I admit to not reading it cover to cover, but I cannot imagine anyone wanting to do so. That said, it is definitely a great addition to my library.
21 of 21 people found the following review helpful
- Published on Amazon.com
While most python books teach you how to write code in the language, this book takes a different approach - it shows you how to build python programs using existing code from the standard library. As every python programmer knows, the best way to leverage the power of the language is to use the built-in functionality of the library.
True to its title, the book features numerous examples, each one fully annotated, explaining how to use the modules.
Need to parse text using regular expressions? Python has a module for that. What about searching file system directories recursively? Network sockets? Those and hundreds of other useful tools are available in the standard library. Hellman shows you how to use the existing modules in the library so that you don't have to reinvent the wheel.
A word of caution for those who are new to python: the book assumes familiarity with basic language syntax.
Overall, this book compares favorably with the other python texts I have read. What makes Hellman's book exceptional is that it concentrates on an important area of the language that has been relatively unexplored by most of the python tutorial literature. Other excellent python books include Mark Lutz, "Programming Python," and David Beazley, "Python Essential Reference."
19 of 19 people found the following review helpful
- Published on Amazon.com
I have kept one star in reserve, and only awarded four, because of two limitations of this vast reference work.
First, it is not quite as complete as the title would claim; the recent "email" module, for example, gets no coverage at all, and at a few other spots its tour of particular features seemed rather cursory.
Second, it lacks a strong editorial voice; the short paragraphs that tie together the working examples that make up most of the volume's bulk rarely give the reader any canny knowledge about which libraries to use, which ones to avoid, and which have been supplanted by better third-party offerings. This kind of advice would really increase the value of the book to newer programmers, who often do not know which parts of the ecosystem to avoid -- for example, it would be great if a future edition said, "try looking at Tornado or Twisted Python if you ever get the temptation to try out the asyncore module!" Instead, the book provides its usual deadpan introduction to the module followed by increasingly interesting examples, never pausing to note that the library is old, un-Pythonic, and abandoned.
But with these two limitations noted, the work remains the best reference to the Standard Library in print. Too often, the official documentation takes the form of a pile of unassembled tinkertoys scattered across the floor -- and is of little help to a programmer who does not already know which three working pieces are all that is needed to get a working example. This book, by contrast, performs the actual assembly: each library is used to build a series of programs that perform a wide range of common tasks. This is exactly what most programmers need in order to get started with an unfamiliar API.
33 of 36 people found the following review helpful
- Published on Amazon.com
I had pre-ordered this book, as the author's website and blogs have always been excellent in their ability to give concise examples for the usage of Python's extensive standard library. I have now had the book for a few days and I am very pleased with it.
I sometimes wonder when I will buy my last physical book, as digital versions are becoming standard. This book, however, is a great example of some of the great computer books that lived most of their lives right next to my computer: a well-organized reference manual with a great index and table of contents (you can view these on the Amazon page for this title).
I teach Python in my high school Computer Science classes, and have always loved the fact that I can write Python code quickly and successfully for so many tasks that come up when teaching. Learning Python is one thing--being able to utilize the standard library in "Pythonic" ways is another skill entirely. The core language is perfect for introducing students to real programming--the instructor can choose to introduce many of the functional programming aspects of Python after students have become comfortable with the traditional imperative approach (gradually leading to an understanding of abstraction in a natural way). But it won't be long and students will start discovering just how easy it is to utilize the standard library for many of the tasks that are coded from scratch in books that merely use Python to teach the fundamentals of Computer Science and Programming. This book is an excellent reference to have for those students that want to use Python for tasks outside of the usual core language programming challenges that they are learning in class. I have students who have used Python for tasks that I had simply never though of--like my student that wrote a forum bot to alert him via email whenever new posts on our phpBB forum appeared. Other students have created chat rooms and file servers with amazing efficiency using Python.
I highly recommend this book for anyone that 1) wants to learn how to utilize the "batteries included" in Python, 2) need a handy guide for working outside the core language. As an educator, I love how easy it is to simply pick up this book, open to a random spot, and quickly get ideas for examples to use in class that will help students see the amazing potential Python has. Also, although the standard library has excellent documentation, the vast majority of students simply want to see examples and then try altering them for their own purposes. This book provides those examples that are simply not collected anywhere else in such an organized and accessible format.
7 of 7 people found the following review helpful
- Published on Amazon.com
"The Python Standard library by Example" weighs in at 1200 pages. It is an expanded version of Doug's blog so check if you like the style there ([...]).
The book assumes you already know Python and are comfortable reading it. Unsurprisingly, the book is code heavy. However, it is good code heavy. The examples are only as long as they need tob e to communicate a point rather than including redundant information. Output is included to clearly understand what is happening. Another advantage is you get to read a lot of Python seeing libraries used properly and common idioms.
My favorite things:
1) build up to a more complex example such as wih regular expressions.
2) clearly indicates what version of Python API introduced
3) defines terms without assuming much outside knowledge on domains like threading
Since the book was so thick, I read half of it and skimmed the rest. It is very easy to jump around and go back to the relevant parts when you need them.
Disclosure: I received a copy of this book from the publisher in exchange for writing this review on behalf of CodeRanch.