Author: Robert Sedgewick, Kevin Wayne, and Robert Dondero
Publisher: Addison Wesley
Audience: Students expecting an academic approach to computer science
Reviewer: Mike James
Python is often the language of choice for academics so why not an academic book on Python?
This is not a dummy's book but it is at an introductory level. In place of crazy graphics and easy-to-read, if often over the top, language what this book offers is simple things said in sophisticated ways. You could say that this is Python in academic speak.
Of course, how you feel about this depends on who you are and where you want to go. If you just want to learn to program using Python then you will probably dislike this book a lot. It simply uses the wrong sort of language and mostly the wrong sort of examples. If, however, you are taking or providing an academic introduction to Python and preferably technical computing/computer science then this book might strike the right tone.
The book is divided into four parts and the first is called "Elements of Programming". Chapter 1 gets you to write, or rather copy, your first program "Hello World". However, this slightly more complicated than it needs to be because the book is using Python 3 but tries to make it so that all the programs would work on Python 2. What this means that instead of using print() which only works in Python 3 because in Python 2 it is just print without the brackets, the book uses:
Yes, this works in both versions of Python but it isn't the way most programmers would do the job in either Python.
Chapter 2 reveals the book's real agenda. It introduces the built in data types and we have paragraph length definitions for literal, operator, identifier, variable and so on. We also have definitions of int, float, bool and str. Of course, one of the advantages of Python is that it isn't strongly typed and so issues like these can be left until the beginner has mastered difficult concepts such as variable, assignment and the whole idea of expression and flow of control. But this book isn't aimed at the innocent beginner but the beginner who wants to be educated in computer science - Python is just a bystander and learning to program is a secondary issue. If you need even more proof of this, a page or so on we have an introduction to formal object-based definitions. This book may cover the simple introductory topics, but it doesn't do it in a way that is helpful to the real beginner.
If you survive with the book until Chapter 3 you will probably make it to the end. At this point we are introduced to the flow of control, conditions and loops and before this has had time to sink in we are introduced to nesting and Newton's method. Another warning to the innocent, no math was spared in bringing this book to your brain. If you are even slightly iffy about math this is not the book for you because most of its examples are math-oriented.
The rest of the introductory section continues in the same way with a look at arrays, input/output and a final case study to finish. If you are academically able, very bright, not afraid of math then you probably could learn the basics of programming from this section but there is a good chance you would have missed the point of it all.
The second part of the book is about functions and modules. This is a good order in which to do things because functions and modules are not the only historically the first way to organize large programs but they logically lead on to the topic of objects, which is discussed in the third section. However this particular introduction includes a lot of math and a lot of additional ideas that make it hard to see what functions are all about. Are they about implementing math? No, they are about breaking your program down into manageable chunks. This isn't a basic look at Python functions, it is more a look at the whole idea of encapsulation with Python functions playing a supporting role. And, yes, we get to recursion before the section is out.
The section on objects will be tough for any reader not already knowing what objects are all about. The examples are of DNA gene replications and point particles. It is very difficult to see the programming idea that is being explained in among all the difficult, off-topic, science. The final case study is an n-body simulation, which is fun, but a multi-sprite game would have given the appearance of being fun to a wider audience.
The final section of the book throws of any pretence that its main subject matter is Python. This is on algorithms and data structures and it is essentially a look at some basic computer science - performance, sorting and searching, stacks and queues, symbol tables and finishing up with a graph based case study. Yes, there is Python in there, but it really is only there to make sure you have something to program the real subject matter in.
At this point you are probably thinking that I hated the book and wouldn't recommend it to an enemy. This isn't quite right. I enjoyed reading many parts of the book and I can imagine that there are other potential readers who would get a lot from it - but not the complete beginner.
The opposite problem is that if you are not a complete beginner then you are going to find some of the early material too familiar to be interesting. Don't worry, the book soon gets into its stride - just skip a few chapters. Do keep in mind however that the main purpose of this book isn't to teach you Python, it is to get you to know enough Python to follow all the other things it wants to tell you about.
So how can you decide if this is a book you want to read?
The best test is how much you like math. If you are happy to solve a quadratic and know what a Gaussian distribution is but only have a rough idea of programming then you might like this book.
For alternative books for beginners, including textbooks with a very similar aim of introducing computer science see Python Books For Beginners.