REVIEW - Python Cookbook - 3rd Edition


Python Cookbook - 3rd Edition


David Beazley, Brian K. Jones




O'Reilly Media (2013)




Paul Floyd


March 2021



Verdict: Recommended

Before I get started, one important thing is that this book covers exclusively Python 3 (it does say on the top of the cover ‘Recipes for Mastering Python 3’. So look elsewhere if you need to get a reference for Python 2.

Unfortunately, the Python project that I was working on only lasted a couple of months (something ‘Machine Learning’, surprise surprise) and I haven’t used Python in anger since. So even though I read the book from cover to cover, I haven’t put any of the ideas into practice. This limits my ability to judge how practical these recipes are.

The book is split into 15 chapters, covering all aspects of the language and a few more specific applications. I’d have liked to have seen a bit more numpy and scipy, but you can’t expect all libraries to get covered. The chapters are split into recipes – I make it 262 of them. That makes an average of a bit over two pages per recipe. A few of the recipes are longer – banquets as it were – running up to 15 pages, covering items like parsing and event driven i/o.

The text and examples are concise and easy to follow. One thing that I appreciated was the occasional anti-example with advice along the lines ‘that is the non-pythonic way of doing it, this has X and Y problems and this is a better way of doing it’. I thought that this would be helpful for occasional dabblers like myself. I had one niggle – the repeated use of the word ‘subtle’ for any problem that is tricky. I suppose that this is fashionable in open source circles, but I just found it annoying. Get a thesaurus, for Pete’s sake.