REVIEW - Python Cookbook


Python Cookbook


Alex Martelli, David Ascher



O'Reilly (2002)




Tim Penhey


February 2003



I have no reservations recommending this book.

I was inspired to learn Python after reading The Cathedral and the Bazaar . One of the major problems of trying to teach yourself another programming language just from books is that you often miss out on the idioms the fluent users of the language tend to use without even noticing. The Python Cookbook is an excellent source of Python idioms.

Unlike some of the other O'Reilly cookbooks, the Python Cookbook is not so much filled with recipes, but with methods of cooking. Many of the entries are very simple and often show another way to approach a problem. There are well over 100 different contributors to the book.

The book is split up into sections of related 'recipes'. Each recipe has a brief introduction in the form of defining the problem; a solution is then shown, followed by a discussion of the solution. Often the discussions show tweaks to the solutions that are only available in the later versions of Python.

At least a rudimentary knowledge of Python is needed for this book. The book does not attempt to teach Python as a whole, but more specific tricks or idioms to do with the language.

One of my favourites is also due to first learning Perl. Declaring dictionaries (or hashes or maps or whatever you call them) can be a little verbose in Python and there is a nice two-line function that makes it a little more terse.

I find Python an interesting language and I think that the Python Cookbook would be a great addition for anyone looking to learn the language. I have no reservations recommending this book.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.