How long did it take you to learn Python?

Friday 27 March 2020

Wait, don’t answer that. It doesn’t matter.

Beginners seem to ask this question when they are feeling daunted by the challenge before them. Maybe they are hoping for a helpful answer, but it seems like most answers will just be a jumping off point for feeling bad about their own progress.

Everyone learns differently. They learn from different sources, at different paces. Suppose you ask this question and someone answers “one month”? Will you feel bad about yourself because you’ve been at it for six weeks? Suppose they say, “ten years”? Now what do you think?

The question doesn’t even make sense in a way. What do we mean by “learn”? If you can write a number guessing game in Python, have you learned Python? Are we talking about basic familiarity, or deep memorization? Does something have to be second nature, or is it OK if you are still looking through the docs for details? “Learned” is not a binary state. There isn’t a moment where you don’t know Python, and then suddenly you do.

And what do we even mean by “Python”? Are we talking about the basic syntax, or do you need to be able to write a metaclass, a descriptor, and a decorator with arguments? Is it just the language, or also the standard library? How many of the 200+ modules in the standard library do you need to be familiar with? What about commonly used third-party libraries? Are we also including the skills needed to write large (10k lines) programs in Python? “Python” is a large and varied landscape, and you will be finding out new things about it for years and years.

Especially since it keeps changing! Python isn’t sitting still, so you will never be done “learning Python.” I have been using Python for more than 20 years, and been deeply involved with it for at least half that time. I thought I knew Python well, then they added “async”. I will have to figure that out one of these days...

Since Python is used in many different domains, the things you need to learn could be completely different from someone else. These days, lots of people are learning Python to get into data science. I don’t do data science. Here are more things I don’t know (taken from a random sampling of “libraries you should know” blog posts): TensorFlow, Scikit-Learn, Numpy, Keras, PyTorch, SciPy, Pandas, Matplotlib, Theano, NLTK, etc. How should I compare my learning to a data scientist’s?

My advice to beginners is: don’t compare your learning to other peoples’. Everyone learns differently, using different materials, at different speeds. Everyone has different definitions of “learn,” and of “Python.” Understand your goals and your learning style. Find materials that work for you. Study, and learn in your own way. You can do it.

Comments

[gravatar]
Randy Syring 4:05 PM on 27 Mar 2020

Great post Ned.

> I thought I knew Python well, then they added “async”. I will have to figure that out one of these days...

Thanks so much for saying that! I don't feel alone now. :)

[gravatar]
Layne 8:08 PM on 27 Mar 2020

Any lang is just some variation of lists and loops. From there, think about using using new modules and packages like plugins.

I'm at the point where I can DO anything I want, but am probably a poor "programmer."

You'll trash most of your code anyways ;D

[gravatar]
Ned Batchelder 11:00 PM on 28 Mar 2020

@Layne once you get away from Python/Ruby/PHP/C/Java, different languages present very different ways of thinking about computation. Haskell is not just "lists and loops", for example.

[gravatar]
Thomas Leo 8:14 PM on 31 Mar 2020

I had a co-worker who wanted to add pandas to a project because they found the groupby feature really useful. I pointed them to itertools in the stdlib and they were able to accomplish their task without bringing in a very large project with a number of it's own dependencies.

My years of Django development has caused significant atrophied in my SQL skills, as most of the time I'm using the Django ORM.

It seems like to be at the top of our game in one disciple often comes a the price of atrophy in other aspects of development. In other-words I feel like it's impossible to be great at all aspects of Python. ¯\_(ツ)_/¯

[gravatar]
Sasa Buklijas 10:30 AM on 1 Apr 2020

More of these kind of articles are needed.
It is not possible for anybody to know everything.

[gravatar]
Tony Flury 10:39 AM on 1 Apr 2020

+1 on the async - so glad that even some experts like Ned aren't up with new fangled things like that.
To be honest - I can't even see when I would ever use it - and that is my milestone for whether I 'know' a feature - can I use it in a real live program (not a silly demonstrator).
One day someone will explain what problem it solves, and it will click into place.

[gravatar]
William Higgins 12:53 AM on 2 Apr 2020

I've been asked the title question, too, and I struggle to answer it.

Your thoughtful posting has made me wonder what questions I would rather answer, and here they are:

1. How long did it take to do something useful in Python?

This was shockingly quick. I spotted a bug long before I knew what I was doing, simply because the code was readable enough that I could see that a pattern was broken and didn't make sense.

2. How long before you saw the possibilities of what can be done in Python?

For me, this is the root question. I had no idea what Python was capable of. But it was not long before I saw what others were capable of. And once I understood how they were doing it, it radically changed my view of what I was capable of.

3. How long before you made something useful in Python?

Not long; probably a matter of months. Once I realized that I could dream up my own answer to a problem and then pull it off, I was hopelessly hooked.

But I'll always be learning Python, and always grateful to the people who have helped me learn.

[gravatar]
Dinko Pehar 8:16 AM on 3 Apr 2020

I think of this as most important tip when learning:

> Understand your goals and your learning style.

You must understand your goals, what you thrive to and what you want to create. Creating a project, focusing on something specific will expand our horizons and views. Knowledge will come with curiosity.

[gravatar]
Wing 11:41 PM on 3 Apr 2020

I think the best thing is, to resign yourself to learn for the rest of your life. Once you do that, then you will never be content, and always looking to understand more.

Python for me is a fun (well sometimes) endeavour. It made me fall in love with programming again. When I think about it, it's how I imagined programming would be when I first started.

Coming to think about it, I would love a mentor. Just someone to give me general direction when I'm thinking about how to do something. Someone with a good understanding of python that could tell you why something is or isn't a good idea, based on experience.

There are a lot of smart people who have gone through a lot of pain to bring us the summary and conclusion (Ned Included). I really appreciate that.

[gravatar]
rblandau 10:03 PM on 29 Jul 2020

Great advice, Ned, thank you. Regarding "how long," I think people might judge their progress by Jordan Peterson's rule: "Compare yourself to who you were yesterday, not to who someone else is today." Do you see a difference from your previous programs to your current ones? Are recent ones clearer, simpler, more concise? Have you learned better how to express ideas in Python, so that the code is clearer, easier to read -- easier in particular for a stranger to read?
Most code will eventually be maintained by someone who is not the author. Speaking from my own experience, that is true even of my own code. Programs that I wrote two or three years ago were in fact written by a different person: me, but not the new me, the me back then. And if it wasn't well-structured (and well-commented) back then, it isn't easy for the new me to get back into now.
So if your code still looks good to you -- clear and well-structured so that it is easy to understand and maintain -- a while later, then you probably have learned enough Python to write it well. Pat yourself on the back.

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.