Thu 20 May 2010
In late December, I was approached by Packt Publishing to write a book on wxPython. I turned them down because the editor’s vision for the book and mine did not mesh. Anyway, I did end up accepting the job of being a technical editor for one of their upcoming books: Python 3 Object Oriented Programming by Dusty Phillips. I started doing that in January 2010. The “pay” is a copy of the book plus one other book of my choice from Packt’s catalog. That’s it. I won’t get either book until this one is published, which is supposed to happen in August of this year. This article is a preview of the book.
I didn’t learn the author’s name until several months after I started reviewing the book. For some reason, Packt wouldn’t give me that information. Fortunately, Dusty Phillips eventually revealed his name in the book’s text. Finding his website is a little difficult, but here it is: http://archlinux.me/dusty/. It looks like he wrote up a little piece on his book there as well.
Anyway, on to the preview of the book.
This is not your typical Python book. The first chapter isn’t some simple introduction to the language. In fact, there isn’t even any code whatsoever in the first chapter. Instead, you get lots of UML diagrams and theory around what Object Oriented Programming (OOP) is all about. Oddly enough, it was still an interesting chapter and kind of refreshing in the fact that it strayed from the norm.
The first chapter is followed by eleven more. The next four chapters really dig into how Python use of object oriented programming is built into the language. In chapter 2, you learn how to create classes, add properties, and create modules and packages. Chapter 3 take the reader through inheritance, polymorphism and duck-typing. For Chapter 4, the author takes us into the world of exception handling, including how to create your own custom exceptions. In most chapters, you also get a case study or some exercises and sometimes you’ll get both.
Here’s a quick rundown of the next third of the book:
- Chapter 5 is on when to use OOP in Python, refactoring and the DRY principle
- Chapter 6 covers basic Python data structures (i.e. lists, dicts, sets, etc)
- In Chapter 7 we cover some builtins; list, dict and set comprehensions, generators and overloading
- Finally, in Chapter 8 we start learning about Design Patterns, like the Observer Pattern or the Strategy Pattern
I personally found the Design Patterns chapters to be some of the most interesting. The author actually extends this section into chapter 9 as well. Anyway, I think I learned a lot from this section of the book and I hope to be able to use some of these patterns in my own work.
The last three chapters are about strings and files (Chapter 10); Testing in Python with unit tests, nose, py.test and more; and a quick tour of some popular third party modules/packages, like PyQT, CherryPy, and SqlAlchemy.
Most of the chapters I saw were still in their first or second draft, so they were a little rough. However, most of the information looked really good and I think this will actually be one of Packt’s best releases to date. I own several of their other Python books and none of them are of this quality (assuming that the author actually took his editors’ advice seriously). I’m not shy about criticizing poorly written books or movies, as my friends will attest. If you’d like to learn more about how to use Python in an object oriented way, I think this book will serve you well. You can pre-order the book from Packt (alas, I get no kickback whatsoever…so feel free to order from Amazon or your favorite book seller…I only link it here because it’s the easiest).