REVIEW - Python Phrasebook - Essential Code and Commands


Python Phrasebook

Essential Code and Commands


Brad Dayley


Sams (2006)




Gail Ollis


January 2009



As a Python evangelist I've become rather resigned to people saying 'that's for web stuff, isn't it?' when I enthuse to them about how Python made programming fun again. It's like saying 'C++ - isn't that for banking applications?'. Sure, lots of people use it that way, but there are many more who don't. I was therefore rather disappointed to find half this book given over to the 'web stuff' - but maybe that's just because it seems to reinforce the misleading stereotype I've been struggling against.

It does, however, mean that only the first half of the book is likely to be relevant unless you're doing web programming. That half is not bad as an aide-memoire because it covers bread-and-butter functions that any Python programmer will be using a lot - handling strings, files, data structures. The second half does the same thing for html, databases, xml and so on. It's the day-to-day, basic stuff; the Python Phrasebook selects a few choice functions but doesn't tell you where to get the full story.

Far better to find out for yourself from the excellent online resources and make notes tailored to your own needs. This book feels a bit like someone else's notebook - someone not sufficiently well versed in the language to be the person you borrow notes from. Describing Python's class inheritance as "similar to that in C (sic)" must surely be a typographical mix up, but there are other signs that this a book by someone who finds a bit of Python useful rather than someone who understands it. The obsession with data types is confusing for beginners, while the misunderstanding of what 'dynamic' means - 'it's easy to get creative' - left me dumbfounded. In the ACCU conference static versus dynamic boat race in 2007, the author wouldn't have known which boat to join!

The 'phrases' themselves didn't contain any such glaring errors, though a whole table of socket types is wrong in a classic cut-and-paste error; all the descriptions are in fact file modes copied from an earlier table. There's also a bizarre example of how to slice a dictionary; it's certainly not a common 'phrase' and I'm still trying to work out why anyone could possibly want to do it. But mostly, the errors are ones of omission: regular expressions, option parsing, iterators, generators and list comprehensions - all parts of an essential Python toolkit - are missing.

The claim on the back cover is that the Python Phrasebook 'lets you ditch all those bulky books', but with such omissions it can't achieve that end, leaving me wondering what the book is for. It's not designed to teach beginners but holds little for the more experienced Python programmer. Perhaps the problem lies in the very concept of a phrasebook, a book of useful words and phrases in a foreign language. The linguistic version allows you to say things you don't understand and leaves you ill-equipped to deal with what happens next; good for comic effect but not for a professional programmer. As Monty Python's Hungarian phrasebook would say, my hovercraft is full of eels.

Book cover image courtesy of Open Library.

Your Privacy

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

Current Setting: Non-Essential Cookies REJECTED

By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED

Settings can be changed at any time from the Cookie Policy page.