Two little things to help you become an independent learner of Python, and not rely on tutorials
I don’t think I’m a fantastic writer, by any stretch. I also feel like I’d be better able to explain and show this in a video format… Until then! Here’s some quick thoughts that might make you a better Python programmer, if you’re just or still getting started…
I’ve been programming in Python for over 7 years now, and I still look things up in the documentation on a very regular basis.
Since I’m asked a bit “how to learn to program”, I also try to keep up with decent materials aimed at beginners, for things to recommend.
While this is totally anecdotal, I noticed something lacking from a lot of written and video intros to Python is any mention of (or pointer back to) the actual documentation, and where to start reading, so you can start learning independently.
Especially in Python, I have found the documentation to be extremely well written, and mostly covered with examples that make a lot of sense.
So, here’s just a quick overview of “where to start”!
The built-in functions page
These are the most basic, primary functions that come with Python. Out of the box, these are the smallest “Lego-like” parts that you can start building things with. There are less than 70 built-in functions listed in the Python 3.x documentation. You can see them all right here:
That page links to them all, by name, in a grid at the top. Then goes in order down the page explaining how to use each one, with basic examples.
Don’t fret: You do not have to memorize this list! But you’d be well-served to skim it once in a while, and be familiar with what’s here. You’ll get faster and faster at knowing when you need something here in the “built-in functions”, or if you need something more “specialized”.
As a person who has not memorized every function and argument value (who has?) I land on this page quite a bit. Googling “Python built in” if I can’t be bothered to use a bookmark.
Think of it as just one of your tool boxes! It’s good to be familiar with which tools are in which boxes, of course.
I’m sure I’m going to overlook a great example of a built-in, but here’s just a few of the most basic things you get, right out of the box:
- Which of these numbers is the highest?
- Are any of these things true/non-empty?
- How many items are in this list?
- Do something to each of the items in this list, and give me all the results.
The Standard Library index
The built-in functions are just some of the “Python Standard Library” – the standard set of tools that come with Python, that you can use without installing any extra software.
Technically, they’re the second thing in the list… see?
The index of the Python Standard Library walks through the very-well organized list of stuff that comes with Python.
There’s a lot. But, again, you don’t have to memorize this stuff! It may be years before you use even half of it!
However, “taking a stroll” and at least skimming through this list now and then will familiarize you with the array of things available to you.
A very small example:
- Need to do things with text strings? Section 6 in the index is Text Processing Services with “a wide range of string manipulation operations and other text processing services”.
- There are Numeric and Mathematical Modules
- If you’re dealing with reading and writing files, there’s File and Directory Access
- And there’s some very handy things in the
itertoolsmodule, listed with the Functional Programming Modules
The point of at least looking over those parts of the documentation is so that when you come across terminology in videos or written tutorials, you won’t be stuck at “I have no idea what that is”. You’re more likely to remember that you’ve at least seen some mention of it, and you’ll be able to more quickly get to the definition, and some basic examples.
Another great resource, regarding the Python Standard Library, is the “PyMOTW” project. It stands for “Python Module of the Week”. There are two areas of the site, each dedicated to Python 2 or Python 3. They walk through each section of the Standard Library, and show examples of usage, and explain what the modules are for.
I realize I haven’t covered how to read the documentation. If you’re very new to programming, or Python, even being pointed at the Built-In Functions page may not make much sense to you.
Hopefully this is helpful to some folks, and perhaps if there’s interest in the future, I can spend more time diving in to how I find what I need from documentation, how to read parts of it, and provide more examples and explained terminology.