Python Cookbook

Ed. Ascher, David; Martelli, Alex
O'Reilly 2002
ISBN 0-596-00167-3
Date finished: 2002-10-27

A big thick book that collects hundreds of recipes from the online Python cookbook. I've been using Python since 1995, and still found reading this book useful, reminding me of features that I've forgotten about or never added to my store of idioms. For example, there's the setdefault() dictionary method that I always forget exists, or a way to use the struct module to split a string into N-character chunks.

The chapters are better the closer they are to the language fundamentals, because higher-level topics are impossible to cover in a single chapter. For example, the chapters on object-oriented programming, algorithms, and "Python Shortcuts" are quite good, while the chapters on user interfaces and web programming are scattered and likely won't help with your particular problem. (The prose in the object-oriented programming chapter does suffer from having to explain both classic and new-style classes all the time, but that's unavoidable with Python 2.2.)

Often the chapter introductions, each written by a different contributor, are quite valuable; I'll single out Tim Peters's introduction to the "Searching and Sorting" chapter as a high point, but Alex Martelli's 5-page overview of Python's object-oriented features is also quite good. Most of the introductions, and a fair chunk of the recipes, are written in a friendly style that's often fun to read. A programming book that's useful for both novices and experts, and is also fun? What are you waiting for? 5 coils out of 5.

Tagged: programming languages, python


%T  Python Cookbook
%E  Martelli, Alex
%E  Ascher, David
%I  O'Reilly
%P  548pp
%G  ISBN 0-596-00167-3
%D  2002
%@  2002-10-27
%K  Python,programming languages

Contact me