Django, Python, & Random Leftovers

Book Review: Expert Python Programming

Author: Tarek Ziadé

Book Website

After you achieve proficiency with a skill, you start thinking less about how to use the tools and more about what you can do with them. Python is no different; after you are comfortable with the data types, the idioms, OOP, and libraries, you will probably start to think about the soft skills of programming and how you can practice your craft better. When you get to this point, I would highly recommend picking up Expert Python Programming.

It's not a book about how to program in Python; many great titles already cover that topic well. Instead, it's a book about how to program Python better. It assumes you already are comfortable with the ins and outs of Python: data types, inheritance, object-oriented Python techniques, etc. When you are ready to take your skills to the next level, start here. These are the techniques you'll need to know to flourish on a software development team: naming conventions, "Pythonic" programming, writing good documentation, test driven development, the development life cycle, profiling and optimizing your code, working with version control, etc.

When I set out to learn many of these topics, I spent hours scouring blog postings, reading through news groups, following link after dead link. I'm astounded that someone has put all this knowledge into a single volume; I would have paid hundreds of dollars for this information a year ago.

Some of the high points of the book from my experience running a software development group are the documentation, test driven development, and profiling chapters.

Documentation is something that often suffers on large projects. After all, we are primarily programmers, not writers and editors. Everyone has a different style, and it's not easy to craft a well-structured, easy to read document describing the code or project. The chapter on documentation talks about how to structure the text, what sections to include, the style to use, and has a great introduction to restructured text, a common format for technical documentation. There is also a great section on the Sphinx documentation system that is now used to compile the official Python documentation.

Test driven development is also covered with information on how to test your code with the unit testing frameworks. For people who are developing reusable modules, APIs, or code for public consumption, this chapter should be required reading. Learning to write software tests and having the discipline to do it religiously will make you a better programmer - I can guarantee that after having gone through the process myself. The chapter clearly explains the how and the why of unit testing with some great examples.

The profiling chapter is worth the price of the book as this information is extremely difficult to find, and what you can find are usually bits and pieces of information that you need to put together yourself. It clearly explains how to profile and optimize your code, look for trouble spots, look for memory leaks, etc. Did you know that sets are more performant than lists? If not, you should read this. (that's an easy example, and there are many more in-depth ones)

If you want to be good, not just proficient, at Python, take a look at this book. It's bound to become a valuable reference in your library.

Here's a free chapter PDF of Chapter 10: Documenting Your Project

Articles by Category
Python, Django, Subversion, Mac, Linux, PHP, PostgreSQL