Top positive review
11 people found this helpful
More than a cookbook
on August 6, 2006
String handling, money, time, dates. Email, network sockets, cgi, xml. The staples of the cookbook, and Python Cookbook certainly has these. However, interspersed throughout are chapters that seem to have come from at least one other completely different book, a more discursive rumination on Python programming in general. Each chapter begins with a mini essay from a Python luminary, and the discussion of each recipe is fairly extensive.
If you do any scientific or engineering work, you'll know that Python is everywhere on the scientific desktop, providing bindings, scripting and GUI front ends for ancient Fortran/C monstrosities. Reflecting this interest, there is a strong emphasis on performance, with chapters devoted to algorithms and searching and sorting.
Elsewhere, those who have graduated from the plethora of beginner's books, but have been bemused by the complete lack of any intermediate texts, will be pleased to find chapters on Python shortcuts (getting the most out of sequences for the most part) and one on generators and iterators. Futher, there is a chapter on OOP the Python way (including examples of dynamic delegation and design patterns implementation), and one on metaclasses.
This is an extremely useful book, particularly the chapters on using Python's basic collections, which will furnish the reader with some essential idioms for efficient use. However, this, and the OOP chapters would have been better as a separate book. But in lieu of a Thinking in Python or Effective Python, you need this book if you want to do any serious development in Python.
As a cookbook, it has everything you will be expecting as a springboard for exploring the standard library, except for regular expressions. But these are so well covered in introductory books, that you won't need enormous coverage here. On the other hand, the material is presented in a fairly wordy manner, which makes for interesting reading, but for dipping in and out, makes finding things more difficult than it might be.
The other notable thing about Python Cookbook is that it has rather a large number of errors in it. You will want to check the O'Reilly website for the errata, especially if you don't have the most recent printing, rather than scratching your head over why the Singleton implementation doesn't work at all.
Nonetheless, this is a vital resource for Python 2.4 users; even if you don't think you need a traditional cookbook, there is an enormous amount of material here you can benefit from.