How I’ve Been Learning Python

How I’ve Been Learning Python

How do you learn a new programming language quickly and efficiently? Often it’s not just the language; familiarity with frameworks, tooling, community, and culture is also crucial if you want to be effective. This post skims over how I’ve addressed those concerns whilst learning Python over the past months.

Python’s official logo

credit: http://www.xda-developers.com/

Each of the tactics I mention in this post is used with an iterative process, where I’ll read a bit, practice a bit, read a bit, while working on learning projects and challenges. I find this style of learning more interactive and enjoyable than just reading a book. I highly recommend it.

If you have any more tips, please let me know.Played in the REPL

Type in “python” at a terminal and you can instantly play around with syntax and explore libraries. This was a really useful first step in combination with reading beginner tutorials. Even now, I still head back to the REPL to answer quick questions or try new bits of syntax I haven’t used before.

Using a REPL isn’t specific to python, I relied heavily on the REPL when learning other languages like Scala and Erlang, too.Algorithmic Coding Challenges

Websites like HackerRank contain tonnes of coding challenges. I’ve worked my way through about 4 or 5 of these so far. Starting with basics like Fibonacci and moving up to some that actually require thinking.

These kinds of challenges are great because I’m not just reading things out of a book and typing them in. I’m getting a feel for using Python and forcing myself to learn syntax by searching through the Python docs so that I can solve problems.

I also used these challenges as an opportunity to practice TDD in Python; I learned how to run unit tests, and gained familiarity with key libraries like nose and ddt.Created and Deployed a Web App to the Cloud

I built a small web app in django when I knew just enough Python syntax. This was important because I learned not just about the language, but popular tools and libraries like Gunicorn.

I pushed this project all the way up to Heroku. This was again useful. Even in situations where things didn’t work, I was forced to learn and explore on my own. As a consequence I deepened my understanding of macro concepts like modules.

I built an small API on top of Spotify’s excellent API, and then a web front-endWatched Lots of Videos

In combination with my playing around and reading about Python, I download a few gigs worth of talks from PyCon 2014 and watched them during my commute for about an hour a day.

By watching these talks I learned about the BDLF culture. I saw Guido van Rossum himself talking through considerations arising from needs within different areas of the community, such as academics and scientists, who want the language to evolve in new ways.

Here’s that Guido fella From watching talks I also started to understand the history of the whole Python 2 vs Python 3 drama, which did seem a bit odd at first.

My favourite video was Katherine Scott who built a skinner box and published a website-based control panel for it. It was good to see that the Python community is diverse and creative, and helped me to understand the kind of people who are creating the libraries and writing the blog posts that I will be consuming.Studied Production Code

One of my chief motives for learning Python is to be more active in certain projects for my employer, so I’m lucky to have lots of production Python that I can study. Whenever I want a quick break from something I’m working on, I dig out some Python and see what I understand and what I need to learn.

Like many languages, at first when I saw my colleague’s Python code it seemed weird and ugly. But soon I really started to fall for the elegance and clean, type-free expressiveness of this loveable dynamic language. This reminded me that first impressions and perceptions are often quite wrong; I should remember that a lot of people have strong opinions based on this kind of weak evidence.Followed Some Pythonistas on Twitter

Straight-away I went for the big-dog and followed Guido, but he doesn’t really a tweet lot. However, I followed some organisations and useful accounts that do tweet lots of links to Python articles and blogs:

  • @planetpython
  • @pycon
  • @pycoders
  • @PythonWeekly

Then I did a search and found Donald Stufft — one of Django’s core developers. He sounded like he knew a bit of Python. Following these key accounts has been a useful way for discovering other Pythonistas, too.