Book Review: Treading on Python
Treading on Python by Matt Harrison provides a basic introduction to the Python programming language for programming novices.
Background of the reviewer
I have been writing code professionally for 10 years. I’ve spent most of my time in C++, but I’ve written a handful of small Python scripts (less than 100 lines) and a couple medium-sized Python applications (hundreds of lines with multi-threading).
In Treading on Python, I was looking to shore up my Python foundation before jumping into my first big Python project.
I was not disappointed.
Who is this book for?
If you are interested in learning how to write computer programs as a beginner, this book is probably a pretty good place to start. The book starts by persuading you to choose Python as your first programming language for two main reasons:
- Python is used widely in industry
- Python is easy to learn
This book is written primarily for brand new programmers. It provides practical advice for getting started at the very early stages of programming:
- How to edit Python code
- How to run Python programs
- How to use the Python interactive shell
- What a variable is (complete with cattle analogy)
- How to use strings, integers, and lists
However, even if you have, like me, written some small to medium sized Python programs, you will still probably benefit from the following useful information:
- Python’s handy dir and help functions
- The enumerate() function
- The dictinoary setdefault() method
- Python’s concept of None and object id
- List slicing
- import and from...import semantics
- And a surprisingly good list of pitfalls to avoid
Early in the book, Matt spends a lot of time explaining basic programming concepts (like variables). He does this by providing real world analogies (like cattle) that will probably seem superfluous to the experienced programmer, but that may be beneficial to the programming novice. I was tempted to skip the first few chapters but I’m glad I read them competely. The book is peppered with little gems that reveal what writing Python code is all about, and even the most basic topics still provide these insights.
Who is this book not for?
If you are looking for a book that delves deep into Python, this is not the book for you. Notably absent concepts from this book include:
- List comprehensions
- Many Python built-in functions, like any() and all()
- Many handy pieces of the Python standard library, like operator.itemgetter()
I don’t offer this list as a criticism of the book. The book’s stated purpose is clearly not to provide a comprehensive Python treatise for the experienced programmer. But if you are considering this book as a way to delve into any of these concepts, this is not the book for you.
Opinion of the book
Matt clearly knows his Python. He has peppered the book with helpful tips that compelled me to whip out my Python interpreter to experiment. Many of the tips were very handy, even for a semi-experienced Python programmer such as myself.
Matt is pleasingly frank in his recommendations to avoid certain approaches, and after reading the book, I feel like I have a better eye for assessing how “Pythonic” something is. In fact, now that I have finished the book, I can look back on Python code I wrote before reading the book, and critique the heck out of it. Prior to reading this book, my Python code looked a lot like my C++ code, which is just a shame. This book can help inoculate you against such behavior.
The book reads smoothly and quickly. Matt is very careful to keep his explanations succinct and clear, such that you don’t feel like you’re reading a college text book or a reference manual. Even still, the book does contain a high information density.
On my iPad, with the default font size, the book is 243 pages in landscape mode and 147 pages in portrait mode.
I finished the book in fewer than a dozen 15-30 minute sittings.
If you can already crank out Python list comprehensions and lambda expressions, this is probably not the book for you. If you are an experienced programmer and want to learn Python, this is a fast way to start. If you are a total programming novice, this may be a good way to begin, but I’m not a great judge for this audience.
Thanks for your thorough review! You are correct this book is aimed for arming newbies to Python with the best practices. It covers the basics that will allow developers to read and write Python, but doesn’t delve into more complicated material… That will be in Volume 2, which I’m working on.
BTW, the book is available here:
http://hairysun.com/books/tread/ or on Amazon or Barnes and Noble.
Thanks for this review! I am looking for good n00b books that can introduce me to programming.
I am going to put this on my iPad right away.