Some Resources for Learning Python
Here I’m not trying to make a comprehensive list. I just want to suggest a manageable list of really good resources.
Neither can I be comprehensive. What follows is just what I know are good or look good to me for learners.
Prerequisites
A novice (or nonprofessional) programmer’s code often suffers two problems:
-
There is no deliberate distinction between library and one-off scripts. Most work is (long) scripts.
-
Functions are long. A function grows on and on as you feel the need to do more and more.
The first problem is lack of modularity and reusability. The second is lack of decomposition. While both aspects require a lot of experience to master, I feel the latter is even harder to start for a new programmer. The two short reads below reinforce this basic idea of decomposition.
-
Decomposition & Style (pdf) by Nick Parlante.
-
Improve your code with atomic functions by Sean Tullis.
If you have learned something by now, then stop right here, turn to your code and work on these problems. There is no point in learning more language features.
I also suggest we always remember,
- Don’t live with broken windows. Improve, fix, refactor as you go. Don’t think an improvement is not worth doing because it looks “small”, or it “works” for now. You won’t be making the same small improvements again and again. The quality of your code tomorrow is on the level of your code today. If you improve your code today, the code you write tomorrow will be on the level of your code today—only the improved version!—on first writing.
Books and Book-form Websites
-
Clean Code: A Handbook of Agile Software Craftsmanship by Rober Martin. Just going through the TOC of the first few chapters was enough to convince me that this classic is a must-read. Since getting a hard copy, I have read it… 0 times (sorry!)
-
Fluent Python by Luciano Ramalho. This book can be read like an essay—it’s not a reference book.
-
Python 3 Module of the Week by Doug Hellmann. Great online resource.
-
Powerful Python by Aaron Maxwell
-
Python 201: Intermediate Python by Michael Driscoll.
I think learning intermediate-level material is most useful—it is within everyone’s capability, is immensely and immediately empowering, yet stops before the return-on-investment diminishes.
-
Python Tricks: A Buffet of Awesome Python Features by Dan Bader
-
Effective Python by Brett Slatkin
-
Python Course by Bernd Klein. I once read its section on multiple inheritance and got to understand Python’s Method Resolution Order (MRO) in that context. This made me believe that the site goes to decent depth.
-
Python Patterns by Brandon Rhodes.
Guidelines
Talks
-
Many talks by Raymond Hettinger, such as this one.
-
Many talks by Dan Bader. I have not watched his talks. But given his expertise and Python training career, and the topics of talks, I believe it’s quality learning material.
-
Many talks by David Beazley (advanced but entertaining), such as this one.
-
Many talks by Ned Batchelder, such as this one and this one.
-
Some talks by Brandon Rhodes, such as this one.
-
Some talks by Bob Martin, such as this one.
-
Some talks by Venkat Subramaniam, such as this one. One great quote from his talk I remember is something like
Do not confuse “simple” with “familiar”.
One common scenario is that when I suggest a simpler (usually more elegant, general, and extensible) approach to some code block, the other person resists (or silently chooses to reject) on the ground that the suggested approach is needlessly “hard” or “un-natural” or “complicated”. In fact it’s none of them; it’s unfamiliar to her.
“Recursion” comes to mind.
-
and many more…
Blogs and Assortments
-
PyCoder’s Weekly. Entire archive of past issues are here. It’s a good idea to subscribe by email. This one newsletter helps you stay up-to-date with Python and keep learning.
-
Full Stack Python. A lot of links. It’s a curated index of resources with organization and descriptions. More useful after you have learned the basics.
-
In a previous blog I suggested Some High-level Tips for Python Projects.
Specific Topics
-
Google style Python docstrings. This is the style I have adopted loosely. But, it is by far more important to have useful doc, regardless of the format.
I also suggest using type annotations in place of some documentation. Brett Cannon apparently agrees.
-
A Guide to Python’s Magic Methods by Rafe Kettler.
-
and many more…
Finally, I think this reminder is a good one to heed