Think Python: How to Think Like a Computer Scientist
Allen Downey, Franklin W. Olin College of Engineering
Pub Date: 2012
ISBN 13: 978-1-4919393-6-9
Publisher: Green Tea Press
Conditions of Use
Python is becoming increasingly important in its use for scientific and engineering applications. This text is an easy-to-read short volume on the read more
Python is becoming increasingly important in its use for scientific and engineering applications. This text is an easy-to-read short volume on the use of Python for coding, that teaches the reader generic skills of good programming. The topics covered are comprehensive and sequentially coherent, especially for a novice in programming. Perhaps the biggest strength of this book is the fluidity of the topics and the ease of communication in the chapters. There are very useful examples and exercises present in every chapter that progressively walks the reader through the aspects of coding (in Python). There are links with solutions in the book for the reader's benefit as well. This reviewer would have liked an introductory section that describes a step by step installation and use of an editor for Python; however, given the wide choices and the changing environment of editors, this is a minor concern that pales in comparison to the myriad benefits provided by this book.
As far as this reviewer is concerned, the contents of this book are accurate and free of glaring errors.
Since the author has taken the approach of educating the reader on how to think and program like a computer scientist rather than provide a crash course or a recipe-type approach to programming in Python, this book may not become obsolete in the near future. However, as version of Python change their syntax every now and then, the onus might be on the reader to keep abreast of such quirks while reading this book.
As mentioned before, the biggest strength of this book is the fluidity of the topics and the ease of communication in the chapters. There are very useful examples and exercises present in every chapter that progressively walks the reader through the aspects of coding (in Python). There are links with solutions in the book for the reader's benefit as well.
This text is quite consistent in its contents, terminology, framework, and flow of material.
The topics of this book are so arranged in sequential order that it might benefit the novice reader to go thru the book from first to last. However, this may not be true for the slightly advanced reader that may benefit from the modularity of the topic. This reviewer was able to go back and forth between these topics arranged in chapters. The arrangement of the sections within the chapters are also well thought and presented with increasing complexity.
The structure and flow of the book are presented in an organized manner.
The book has working links for solutions, examples, and other resources that are free of issues.
This reviewer could not discern any grammatical errors in this book.
The text is not culturally insensitive or offensive in any way.
The text concisely but thoroughly covers the basics of programming in the Python language, from expressions and functions to file processing read more
The text concisely but thoroughly covers the basics of programming in the Python language, from expressions and functions to file processing and object-oriented programming. The HTML version of the text has an index, but the DF version lacks it, for some reason. Each chapter features a glossary of relevant terms and topics. Chapters are named in such a way that it is easy to glean topics. I was especially pleased to see a chapter on graphic user interfaces and the Tkinter library. Each chapter also includes several coding or thought exercises for the student, and solutions for all of them are provided as URLs and links. Throughout, special attention is given to principles and techniques in program debugging, and the general prevention of syntactic and semantic errors. This is a short book, so it does not go into every final detail of the language. Its purpose is rather to teach fundamental programming concepts using Python, and does so very effectively.
I have not spotted any factual inaccuracies or biases in the text. However, see below for some discussion on the particular versions of Python covered.
The book's subject matter is mostly timeless, in that as long as procedural and object-oriented programming are taught, the content is relevant. A minor concern is that the book concentrates on Python 2, a slightly older version of the language. (At the time of this review, Python is at version 3.4.1.) The author does point out the few places where there is a difference in coding between Python 2 and Python 3, for tasks such as printing and integer division. On the book's web page is a link to a version of the text that is "converted" to Python 3, written by a third party. Those already familiar with Python are probably aware of the protracted transition between Python 2 and 3 in industry and academia. My own preference is that teaching materials cover Python 3 exclusively, to prevent confusion and potentially outmoded coding styles.
The prose is direct and to the point, with surprising clarity. New and potentially difficult concepts are expressed clearly, and when technical terminology is used, it is explicitly defined.
The text is very consistent in its overall style for each chapter, and the book overall feels like a coherent unit.
The book is divided into 19 chapters and three appendices. Chapters are about 10-15 pages long, and appendices are about 5 pages long each. The brevity of the text and the many subheadings for each chapter enables a good degree of modularity. Once in a while, certain concepts are "sprung early" in one chapter, but explained more thoroughly in subsequent chapters. For example, opening and reading from text files was introduced briefly in Chapter 9 to enable the analysis of string/text data, but file manipulation itself was more formally covered later, as Chapter 14. I did not find this practice disruptive. While chapters generally built on one another, I felt that many chapters could stand alone or be reordered as needed.
The text had good organization of topics. Chapters are short, so relatively specific topics such as "Strings", "Files", and "Inheritance" are at the focus of each. Since the chapters are only 10-15 pages long, small portions of subject matter can be more easily read and understood. There was also a good flow of topics from simple to complex, where ideas introduced in one chapter are revisited or built upon in subsequent chapters.
I mainly focused on the PDF version of the text, which was free of errors. Links and URLs were enabled in the PDF, making navigation and lookup simple. My only complaint is that exercises, which are interspersed in the text, are not always set off by white space from any preceding material. As such, narrative sometimes runs into exercises. The flow can still be followed, but it is an odd error.
The text contained no grammatical errors that I was aware of. Based on material in the Preface, the text has been scrutinized by many people over time, and readers are credited with spotting errors and contributing new material.
I found no material that was insensitive or offensive from the standpoint of culture, gender, etc. Some examples and exercises involve the manipulation of text in languages other than English, which is a nice feature, as it shows that some concepts, such as string handling or dictionaries, transcend language. Since the text focuses mainly on Python 2, which does not natively support Unicode strings, there is no discussion of non-Roman languages. In true Python fashion, there are occasional references to Monty Python jokes, including strings such as "spam" and "eggs". While this is harmless in itself, I sometimes worry that as time passes, fewer and fewer students will be familiar with Monty Python, or understand the cultural references.
I was motivated to review this book because I teach a course on basic Python programming to health sciences students. Overall, the book reads best as a brief but comprehensive introduction to computer science principles, with Python as the exemplar language. Some students may not have the background or interests to understand or apply some of the topics covered in the book (e.g., algorithmic complexity or operator overloading), and as such, this text may work best as a short book for science and engineering students. However, I found it to be an unexpectedly readable and usable text, and I plan to try it in a future iteration of my Python course.
Table of Contents
1. The way of the program
2. Variables, expressions and statements
4. Case study: interface design
5. Conditionals and recursion
6. Fruitful functions
9. Case study: word play
13. Case study: data structure selection
15. Classes and objects
16. Classes and functions
17. Classes and methods
19. The Goodies
B. Analysis of Algorithms
About the Book
Think Python is a concise introduction to software design using the Python programming language. Intended for people with no programming experience, this book starts with the most basic concepts and gradually adds new material. Some of the ideas students find most challenging, like recursion and object-oriented programming, are divided into a sequence of smaller steps and introduced over the course of several chapters.
This textbook has been used in classes at Bard College, Olin College of Engineering, University of California, Santa Barbara, University of Maine, University of Northern Colorado.
About the Contributors
Allen B. Downey is an American computer scientist, professor of computer science at the Franklin W. Olin College of Engineering and writer of free textbooks.
Downey received in 1989 his BS and in 1990 his MA, both in Civil Engineering from the Massachusetts Institute of Technology, and his PhD in Computer Science from the University of California at Berkeley in 1997.
He started his career as Research Fellow in the San Diego Supercomputer Center in 1995. In 1997 he became Assistant Professor of Computer Science at Colby College, and in 2000 at Wellesley College. He was Research Fellow at Boston University in 2002 and Professor of Computer Science at the Franklin W. Olin College of Engineering since 2003. In 2009-2010 he was also Visiting Scientist at Google Inc.