Review: Effective Python

I received a copy of Brett Slatkin’s Effective Python for my birthday.

The book is split into a series of lessons. Each lesson is a self-contained discussion of some Python feature or best practice. There are examples, code snippets1, and explanations of the advice. This structure makes it easy to read the book in small chunks, or dip in at random.

It covers a lot of material, from basic concepts like strings, up to advanced topics such as mixins and metaclasses. I learnt a lot of new things – even in areas where I thought I was already well-versed. And I’ve noticed a big improvement in the Python I’m writing, even just while I was reading the book.

My favourite parts were the sections on iterators and generators. Iteration is one of Python’s killer features, but I know I don’t use it enough. It’s a substantial portion of the first two chapters, and I have a much better understanding of iterators than I did before.

This is also the first book to sell me on Python 3. There wasn’t a single great feature, but a lot of nice touches that are only available in Py3. The accumulation of those small improvements convinced me to start writing more Py3 – if you’re on the fence about switching, maybe this will convince you as well.

If you want a taste of Slatkin’s style, watch his PyCon talk How to Be More Effective with Functions. It draws material from the early sections of the book, and gives a flavour of the book’s tone.

This isn’t a good book for learning Python. It assumes that you already know how to write Python, and builds on that knowledge to suggest ways to improve. Perhaps this could be a third or fourth Python book – but probably not your first.

Overall, I really enjoyed reading this book, and I know I’ll be using it again in the future. I would recommend it to anybody who already knows how to write Python.

Syntax highlighting made it much easier to understand the examples. It’s by no means required, but it really does change the reading experience.


  1. As a bonus, all the code samples are printed in colour. ↩︎