Years ago I purchased a copy of the very first edition of Learning Python.It was a small book, about 350 pages, but in 1999 when it came out, it was one of the best introductions to the language that existed. I hadn’t picked up my copy for some time, but I remember well how useful it was when I first bought it. When O’Reilly offered me a free review copy of Learning Python, fourth edition, I figured the differences between the two editions would primarily consist of updates to the content based on the differences in Python release versions, and that I wouldn’t likely learn much more from the new edition. I was wrong, and I will explain how and why below.
This book is HUGE. It weighs in at over 1100 pages and is filled with clear explanations, interesting history, and the most useful description of the foundations of the Python programming language that I have seen. The material was developed by the author, Mark Lutz, over the last decade, during which he has taught hundreds of seminars introducing Python. Lutz compiled the new edition based on the materials taught in a three day training class, complete with quizzes and meaningful exercises. While Lutz was one of the two original authors of the first edition, he is now the sole author of the book and it is obvious that his extensive experience teaching seminars has refined his presentation of Python in ways that will benefit readers of this book. The understanding of student needs shows clearly in the text, which focuses on the core of the language.
Learning Python is based on the new 3.x series of the Python language, but points out the differences between it and the still-supported and sometimes incompatible earlier 2.6 edition, so whichever version of the language you are learning or require you will find the information you need to begin here. Some may ask why cover the old version when the new one has so many improvements, but the answer is simply that there is a lot of legacy code that is not going to be updated soon and so people will need to support that code, which is often incompatible with Python 3.x without some changes.
The book covers many topics, none of which seem unimportant or superfluous. While the page counts seems quite daunting, a closer examination shows there is no need to be intimidated. The page count does not add complexity or difficulty, but actually gives room for clearer and more complete descriptions and definitions alongside practice questions that students will find very useful. The topics include all of the obvious foundational needs starting with history, how to run programs and use some common editors. It moves to core data types and operations, spending several pages clearly defining and describing each and how they are used, before introducing statements and syntax on page 261. I like how the differences between 2.6 and 3.x are clearly shown, such as the change from a print statement in 2.6 to a print function in 3.x and how either is implemented and used as well as the reasoning behind the change. Functions are introduced and discussed, as are modules, classes, object oriented programming, exceptions, and several advanced topics. There are two appendices covering installation and configuration and giving the solutions to the exercises in the book
It has been a long time since I did any programming. My life took a different path. This book has reminded me of how fun it is to write and read code in Python and made me wonder how I might find or create opportunities to return programming to my busy life (but this time around, if I make the time to write anything, it will be in Python 3.x). This book is why.
Lutz has also authored O’Reilly’s Programming Python, which was explicitly designed to be a follow up text to this one, which I have read and which also sits on my bookshelf, but which I have not reviewed (I bought that one a couple years ago and at the time was not writing book reviews.–if there is interest, I’ll review it at a later time).