read

I’ve just had the pleasure of doing a technical review of the second edition of the Python Cookbook (my name’s on the cover for historical reasons, but Alex and Anna did all of the editing for this second edition).

This new edition, in addition to incorporating new and updated recipes from the online cookbook, focuses on today’s Python, not the historical amalgam which the community uses in practice. That editorial choice makes the book a very different book than the last, which was edited at a time of transition for Python. In the first edition, we spent a lot of words talking about “old-style Python” vs. “new-style Python” (especially regarding the new class model). This edition, doesn’t look any earlier than Python 2.3 and fully stares 2.4 (just released) in the eyes. A lot of recipes were edited, upgraded, or culled, as they were no longer needed. New recipes highlight the new capabilities of the language.

Python Cookbook

I’ve always been proud of my involvement in the cookbook. I liked the first edition in part because I thought the introductions (by invited experts) were a great window into Python, the language, the community, the culture. Tim Peters’ introduction to the searching/sorting chapter in particular sticks in my mind.

I haven’t seen all of the intros to this edition yet, but what sticks out so far is how much I learned by doing the tech review. The language has changed a lot over the last two releases, and the cookbook is more than ever a great way for people like me who still “think” in Python 2.0 or 2.2 to get a refresher. Two new chapters, one on iterators and generators, and one on descriptors, decorators and metaclasses, both introduced (of course) by Raymond Hettinger, stand out as important in helping with that transition.

Python is certainly a bigger language than when I started — but it really does feel like it’s stayed true to its nature over the years, and Alex and Anna did a great job keeping the cookbook Pythonic. Highly recommended.

Disclaimer: ActiveState gets a small portion of the royalties.

Blog Logo

David Ascher


Published

Image

David Ascher

David Ascher's blog

Back to Overview