Writing a book is a huge effort (I'm the author of a couple Python books, one of which is on the current Python Humble Bundle). From speaking with (many) other Python authors, most would do better financially self-publishing. There are few titles that sell very well from publishers (they do 2nd, and 3rd versions), but these would probably do even better if they were self-published.
Of course, there are other reasons for publishing. (People really want their name on an animal book). One of those reasons is that a book is a really good business card. This is especially useful for consultants or when looking for a job. "Why yes, I do know about ...., in fact, I wrote a book on it".
I could blame quite a bit of my business (I do consulting and corporate training) on writing books.