Introducing Python (here’s Amazon affiliated link: https://amzn.to/30ZyWEC) by Bill Lubanovic belongs to my tryptic of ‘ok, I want to really get into Python’.
(If you wander, the other two books are Automate the Boring Stuff with Python (https://amzn.to/2M0j28P) by Al Seigwart - reviewed here - and The Hitchhiker’s Guide to Python (https://amzn.to/30ZyWEC) by Kenneth Reitz and Tanya Schlusser).
Basically, that’s how I started programming.
I started assemblying lines in order to automate the boring stuff, but I needed to grasp more of what was going on while I toyed around with the script. Introducin Python came to the rescue. It acted like a reference grammar, showing me a first picture of what Python syntax is like and how to understand how things work.
The contents of the book are displayed in a logical order, to provide a quick reference. So, if you are looking for something dictionaries related, you’ll find that after lists (in ch. 3).
If this is your first Python book and you are learning by reading, following and doing, that may creating some little issues. You are exposed to dictionaries (ch. 3) before you discover that in Python comments are done with a ‘#’ and line continues with ‘\’ (ch. 4). But that’s really not a real issue.
You got list comprehensions, decorators and generators in (ch. 4), before you are told about modules and how to import them. (If you are interested in scripting related to moving files or similar, there’s a lot you can do with lists and modules).
Again, that’s no problem. It is a reference book explaining you how things are done, not a cookbook with receipes. The book will allow you to go from A to B enabling you do choose your path.
So it starts presenting data types and introduces you classes and objects (ch. 6). Only in chapter 8 you are told how to open and write a textfile (but in ch. 7 you learnt about UNICODE). And, beware, textfiles are just a little drop in the Ocean. HTML, JSON and other file formats with more structure than a .txt will soon come after opening a file.
Chapter 9 moves on to reaching the web and have our programs interact “out there”. Chapter 10 covers file systems and 11 Networks and Concurrency. With chapter 12 the book wraps up and you’ll discover that proficiency in Python is what “Pythonistas” have achieved and that there are “Pythonic” and “non-Pythonic” ways of doing things.
The appendixes are letter named. The first three (A, B, C) are particularly interesting as they show the use and impact in the Art, Work and Sciences. (There’s a reason why you started programming… ). These chapters presents you different libraries and projects and offer you chances to try out the stuff you’ve learnt.
Then there’s an appendix with instruction on installing Python (D), one with the answers to the exercises (E) and one with cheatsheets (F) to help you have some of the most needed commands printed on a wall near you laptop.
The chapters of the books end with a “Things to do” section. Such sections test your basic understanding of the main concepts, prompt you to explore some of the concepts (sometime starting live in the Python shell, with no need to bother writing and saving whole programs) and give you exercises and problems to solve. The exercises are not hard, which is a good thing when you are starting out.
(Full disclosure. I first read the book without doing the exercises, as I was busy working on Al’s stuff. I then got back to the exercises and realized the were the perfect companion to a “read and practice” approach. You may argue that’s not the case with other kinds of exercises such as Think Python exercises that are more complex than these.)
My pick for the book is probably the last chapter. Ch. 12 is about being Pythonistas, even though the chapter has more to offer. First, the chapter invites you to go out and read code from the standard library. This is a sensible advice and it’s good to receive it after having a though tour of various Python’s blocks.
The chapter then goes into using an IDE (which is probably an advice you should have way earlier in the book) as well as testing and debugging. There’s a lot there. This is probably worth a chapter on its own. These information are precious but somehow hidden in the end. In fact, while on testing and debugging you are told how to time the execution of your code and be aware of the fact that performance is an issue… (The rest of the chapter offers you links and information of how and where to learn more, getting back into the ‘Be a Pythonista’ Mood.)
I pick the most controversial chapter, at least from the point of view of the flow of contents, structure of the book and title-to-contents correspondence. But despite this, its contents are worth spending some extra time with them.
If you want to get something more from the book I suggest to go through the first three appendixes and try something out… what about making a videogame with pygame?