Author: J R Parker
Publisher: Mercury Learning & Information
Audience: Science students
Reviewer: Alex Armstrong
There are lots of books on Python, so why another?
A very good question. This is a very straightforward book. You might describe it as friendly and academic at the same time. It isn't an exciting book and it often strays into things that you don't really need to know to program in Python, but which might be thought to be good for you. For example, Chapter 0 is a rapid look at the history and some basics. As the book is aimed at teaching science majors or science students some computing, the note to this chapter says it can be omitted. It really is no more than a flavour of introductory computer science and, even if not omitted, isn't going to do justice to the subject.
If you are going to use the book to teach a course then you might be interested in the extra material provided - answers to the exercises, all the code and some PowerPoint lectures.
The book really gets going at Chapter 1 which gives you a reasonble introduction to the basics of programming and Python. There are a number of examples that are reused thoughout the book, including a simple number guessing game. These serve to illustrate the point and they don't promise the reader that they are going to be exciting or profitable. They are what they are - simple examples. Things are quite fast-paced, however, and there is a tendency to be complete rather than gradual. For example, the if statement is introduced in all its complexity including else, elif and some very nested if statements.
Chapter 2 introduces loops, both while and for, and gets into random numbers and nested loops. It also introduces exceptions. Chapter 3 introduces some data structures - strings, tuples, lists and list comprehensions. From here, in Chapter 4, we move on to functions and how to use and define them. Given the slightly academic tone of the book, it isn't surprising that recursion is introduced, which is a shame because you really don't need to know about recursion this early.
Chapter 5 jumps topic to files and dealing with the real world of CSV files. This is a bit out of order, but reasonable as the book is targeting scientists who need to read in data. Chapter 6 is more or less the last chapter on core Python. It introduces classes and object-oriented programming - all too quick to get the idea if you are not prepared to work at it.
From Chapter 7 on the book consists of applications and how you should use Python rather than details of the language. Chapter 7 is about using Glib to produce simple graphics. Chapter 8 is on data and very late on we meet the array. Chapter 9 is on digital media, which basically means the games graphics, sound and video. Chapter 10 is a selection of basic algorithms in computer science - sorting, searching, random numbers, cryptography and so on. This is far too shallow a look at an important topic. For example, the sorting algorithms covered are selection and merge sort, which isn't really enough. I'm not sure why cryptographic algorithms and evolutionary algorithms are covered in an introductory book.
Chapter 12 is about writing good code and here of course any author is doomed to fail. For example, I would never write the horrible set of nested if statements to process a command structure - I would use a look up table instead. The point is that this is subjective. The second half of the chapter looks at the object-oriented implementation of a game which essentially identifies objects with sprites, which is a very special case of object use. As Chapter 14 is a reference to Glib, Chapter 13 is really the final chapter of the book, It deals with working with real world APIs - email, ftp, Twitter and calling other languages.
Overall the book has a "home-spun" feel to it. The style is readable and despite having a slight academic tendency it isn't too computer science-based. In fact. for some purposes it might not have enough computer science in it. There is no discussion for example of methodologies or testing or debugging. Python is a big world and even a 600-page book can't cover it all. What I would say is that there isn't as much basic Python in the 600 pages as there could be. Coverage of the language proper finishes at page 250 and there is so much more to say about using Python - a single chapter on classes and objects, for example, really doesn't do the topic justice.
This isn't a bad book but it isn't an outstanding book. If you need a semi-academic book on basic Python and on many ways in which it can be used then you might like this book.
For more recommendations of Python books see Books for Pythonistas and Python Books For Beginners in our Programmer's Bookshelf section.
To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.