Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Intermediate Python learning resources?
113 points by jesusx on July 6, 2013 | hide | past | favorite | 41 comments
So I've completed Codecademy's course on Python, I have some experience fiddling with Flask and putting together random Python scripts. Generally, when I want to build something that I've never built before, I look up how to do it on Stackoverflow and manage to understand most of the things.

How can I take my knowledge to the next level?

Free learning resources are preferred. Hopefully ones you have used yourself when in my position.


If you work with other languages in addition to Python, it's easy to fall back into old habits. You should internalize the content from these two excellent presentations:

Raymond Hettinger's "Transforming Code into Beautiful, Idiomatic Python":


(pyvideo.org has a lot of other great talks and presentations.)

Ned Batchelder's "Loop Like A Native":


Python Module of the Week is also an excellent resource:


Watching the video was worth it for realizing when you'd want the second argument of iter()

I'm in a very similar position.

If you really like Codeacademy, there are non-track exercises that involve Python in the API section [0] and a couple of Python challenges [1][2] that aren't listed.

What I'm doing now:

* Solving exercises on Project Euler in Python. [3]

* Working through each example in the Python Cookbook[4]. It was just updated to the third edition.

* Watched Guido's Painless Python talks from a few years ago [5]. I found his concise explanations of language features really helpful.

Some things I intend to do:

* Finish working through Collective Intelligence [6]. The examples are written in Python.

* Work through Introduction to Algorithms [7]. The course uses Python.

* Read, understand and give a shot at extending Openstack [8] code.


0: http://www.codecademy.com/tracks/apis

1: http://www.codecademy.com/courses/python-intermediate-en-NYX...

2: http://www.codecademy.com/courses/python-intermediate-en-VWi...

3: http://projecteuler.net/

4: http://amzn.com/1449340377

5: http://www.youtube.com/watch?v=bDgD9whDfEY

6: http://amzn.com/0596529325

7: http://ocw.mit.edu/courses/electrical-engineering-and-comput...

8: http://en.wikipedia.org/wiki/OpenStack

Aren't Project Euler's exercises seem more likely maths exercises? It's kinda difficult for those who graduated from social sciences and tries to learn programming from scratch.

The Green Tea Press books are great; and free.

Think Python: How To Think Like a Computer Scientist http://www.greenteapress.com/thinkpython/thinkpython.html

Think Complexity: Exploring Complexity Science with Python : http://www.greenteapress.com/compmod/

Think Stats: Probability and Statistics for Programmers : http://www.greenteapress.com/thinkstats/index.html

>Aren't Project Euler's exercises seem more likely maths exercises?

Project Euler does involve a math, but so does efficient programming.

Efficiency can seem a pretty abstract thing and it might not crop up right away in more typical programming tasks. Working a Euler problem and refining to a solution that runs in 1% or 0.001% of the time required for the most straightforward solution is a great demonstrator.

>It's kinda difficult for those who graduated from social sciences and tries to learn programming from scratch.

Sure, but the context of the question here isn't really from scatch. The OP has already completed at least the 296 exercises in the Python track at Codeacademy to establish a base.

Personally, I haven't graduated from anything and I treat the Euler exercises as an interesting way to practice/learn a bit of programming and math.

Yep. Project Euler is a waste of time if you're trying to get up to speed in learning programming.

You can search announced, in progress, future, self-paced, and finished MOOCs (Massive Open Online Courses) with class-central.com : http://www.class-central.com/search?q=python

I'm enjoying 'Data Structures and Algorithms using Python'[1]

Coming from a C++ background, I felt uncomfortable using python as more than a glue/scripting language, because the way resources are managed is treated very magically in most tutorials.

Say I want to use the OpenCV library to fling matrices and images around, it's hard to be confident of what the runtime is going to do with the data without having a really good handle on what mechanisms python has for dealing with data. Which is what this book is about.

As useful as they are for interviews, classic algorithms and data structures are probably not a big part of most peoples work, but understanding how they can be done in python helps you to make assumptions and use libraries in smart ways!

Most of all, it's fun and well written, for an algorithms book. It's more about python than algorithms, so if you were student wanting to learn algorithms, this book is better[2].

[1] http://www.amazon.co.uk/Data-Structures-Algorithms-Using-Pyt... [2]http://www.amazon.co.uk/Introduction-Algorithms-T-Cormen/dp/...

Disclaimer: This may seem harsh but I really don't mean to be harsh.

If you have "only" completed Codecademy or similar, you're nowhere near the intermediate mark. I have used Codecademy and Code School and they are indeed great. But they give a false sense of security and accomplishment to the user. They are great for introduction to a language but they only introduce you to the language, nothing beyond that.

Don't get me wrong, I applaud you for your will to learn programming. I'm not trying to make your accomplishments look insignificant. But I believe that, at this point, your accomplishment is not finishing Codecademy's very very introductory course on Python but taking the first step in the path in learning programming.

I suggest that you take a look at Zed Shaw's Learn Python The Hard Way. The beginning may look a bit too easy, after all Codecademy does teach you stuff. But midway through you will probably see that Learn Python The Hard Way introduces beginner stuff that hasn't been covered in Codecademy.

After that, continue reading about Python. Sadly, the real world isn't divided into categories marked as "Beginner, Intermediate, Advanced". Read source codes that actually interest you. You are bound to come across stuff that you have no idea about. Start reading about that stuff. Chances are really high that you will come across other stuff that you don't know about when you're reading about the first stuff that you didn't know about. You will probably end up reading (and learning) craploads of stuff, but in my experience that's how you really learn stuff.

I have learned this during my journey in programming. In the end, you are the only one who knows how much you know. Don't measure your knowledge by Codecademy's standards. They may tell you that you are intermediate but you may not even understand how a relatively simple library works.

To anyone who will flame me for writing this, try Codecademy's or (Code School's) courses. Try and choose a language which you don't know. Don't read any of the info, just read what is expected of you. You will still pass the course. That is a VERY big problem. I'm a beginner, I have felt that false sense of accomplishment. It hurts a lot when you see what real intermediate and advanced people do with a programming language.

I will say, "this" thusly:

SICP is an introductory course in computing. It covers meta-linguistic abstractions. The Code Academy course in JavaScript I completed required a bit of filling in the boiler plate for its final project.

Code Academy is a great project, in part because it is designed to help students achieve success without the pain of the real world. That is also a weakness.

Subscribe to the Pycoder's weekly email list [1]. I love looking through the different libraries - you can certainly learn a lot from digging through source code.

I just found out about Neckbeard Republic [2] today - it looks to be similar to Railscasts. I haven't watched any of their stuff yet, but I plan to.

1 - http://pycoders.com/

2 - https://www.neckbeardrepublic.com/screencasts/

Those are excellent resources. I started a new screencast yesterday -


Do take a look.

What software are you using to screencast?

screeny. Its bare bones but easy to use

And good ol' quicktime to stitch it up.

I was an early adopter of Python somewhere along about v1.x. Loved it. Used my usual technique of implementing a sizable task that I knew well---parsing PGN (Portable Game Notation) a widely used format for recording chess games in digital form. I've done it in every language I've learned. This is an approach that I recommend to anyone in your position. The second thing to do is build your reference library; easier today than before. The third thing to do is find a community of fellow travelers. Were the language Perl, then something like Perl Monks comes to mind. Part of your education lies in the search for all 3---so get to it grasshopper :)

Try learning about some simple sorting algorithms and implement them in python. Most algorithms resources have pseudocode and python conveniently resembles pseudo code in a way. You can just use wikipedia's page on sorting algorithms[0]. You could kill two birds with one stone by sharpening your python skills and get a nice intro to algorithms.

Then maybe try implementing some of the fundamental data structures such as queue's and linked lists[1] along with their basic operations (such as push and pop for queues). Try to see if you can use pythons built-in data structures[2], or do it yourself with object oriented programming.




Heres an applied class integrating Linear Algebra and Python:


This session started on Monday (July 1st) and if you have an interest in Computer Vision, Machine Learning, or Cryptography I'd recommend you join us.

Once you're past syntax and basic concepts, he best thing is probably just to write programs. Maybe try some libraries out. And when you do something you've never done before, (at least on small scale things) do a plan that's all your own work (and things from the docs), and then refer to google, stackoverflow etc. when you have problems that you can't figure out.

As well as that, look into some of the advanced language features and idioms, and try to use them in your programs, or rewrite old programs to use them.

I'm surprised not to see my two favorite learning resources in the comments yet: reading code and getting code reviews.

Exercises are great, but unless you have a way of getting feedback on your solutions, you will progress slowly. Practice doesn't make perfect: perfect practice does.

There's a lot of good code to read. I'd recommend starting with Flask - you already have the context of using it. You might also consider checking out something that Kenneth Reitz has written. Whenever you don't understand why they chose to write something a certain way, ask! Both have very active irc channels.

Speaking of irc, #python is a great place to find reviewers. There are (mostly) friendly folks there at any time of day. You'll maximize your chances of a good review by:

1) having a concrete question to ask: "I'm not sure about my use of kwarg unpacking on line 12; would anyone have done it a different way?"

2) providing a small program (or section of a program) for review. People are generous, but likely won't spend an hour reviewing a few hundred lines of code =)

I hope that helps! Feel free to email me if you're having trouble finding reviewers; I'm no Armin Ronacher, but I've written a good amount of Python.

intermediate python is what i called learning the "pythonic way". the best way to learn imo is about fussing over if you're doing it the "pythonic way".

then you might ask: what exact is the pythonic way? then it is hard to say. on a deeper level (that is coding style): you'd prefer list comprehensions over for loops (not always, but for simple iterables); prefering the functional approach -- immutable input/output on functions etc, learning map/reduce/etc; understanding the performance kinks of python, etc.

on a higher-level, there is the python-for-humans. learn what it means to be beautiful code, not just in terms code style, but how people will use your code. a splendid example which i have immense amount of respect is the requests library by kennethreitz.

retain your curiousity always. the day you lose these curiousity is when you become a mediocre programmer. don't be that guy.

after you're done with these, go deeper. keep going. understand why the fuck people whine about GIL, about concurrency and how bitchy it is in python (and why), and even alternatives to python: for example. when not to use python.

i wish you the best :)

I think Udacity.com has a great list of sources about programming from beginning to advanced. Most of their classes are in Python, but the concepts are applicable to any language. More importantly, they try to teach fundamental concepts that would be useful in a broad range applications. I would highly recommend CS262 Programming Languages: Building a Web Browser.

"Design of Computer Programs" contains lots of advanced concepts and programming puzzles...

At Thinkful (thinkful.com) we're in beta with a python class that covers programming with python, and then web developing using flask. The syllabus overview for the class is here: https://www.thinkful.com/register/syllabus-python

Kenneth Reitz's python-guide definitely is a great resource for project structures, workflows etc. http://docs.python-guide.org/en/latest/

I would say you are at the point where the next level is learning by doing and reading source code. You mentioned flask which I've been told is high quality code, start reading the bits that you use to find out how they work.

I'm not sure whether you are trying to learn to program in general or Python in particular, but you might try out something like ["Design of Computer Programs"](https://www.udacity.com/course/cs212) from Udacity. It's very engaging, somewhat difficult but you'll learn a lot.

Another thing you might try is taking a book with examples in one language and try to implement them in Python. It's a little weird but it can be a great way to have a framework for a task but have to explore on your own.

http://stackoverflow.com/tags/python/info has a huge list of free books or extended tutorials

Learn python the hardway is a great resource. It'll not only introduce you to some interesting quarks about the language. It's setup for daily consumption building on the lesson previous to it. I've used it and I've used C the hardway. http://learnpythonthehardway.org/book/ There is an ebook available for purchase and video tutorials.

I am in the same position and have the same question. Have you tried following Learn Python the Hard Way or reading "Think Python: How to Think Like a Computer Scientist"? Those are to very good resources for learning Python. I would also recommend you try reading up on data structures and algorithms. What's your programming background? Do you know any other programming languages?

I can't really say that I'm one to advise someone on learning to code but....

At some point you just have to start coding and there you'll push your boundaries. I fooled around online python learning but didn't get far until I built a web scrapper. I completely over engineered a one time use script just to learn... IMHO its what can I build to learn?

If you want to build something useful, App Engine is a great way to learn Python. That's how I learned :) Also, Pycharm is good at keeping you PEP-8 compliant, etc... The App Engine API was written very well by Googlers and a lot of things by Guido himself like NDB, AppStats, and Rietveld(a sample app that Google uses for code reviews).

I would suggest watching any topic you find interesting at pyvideo: http://pyvideo.org/ These are recordings from most of the major Python conferences around the world

Check out Python Koans - https://github.com/gregmalcolm/python_koans

It involves learning/hardening your Python knowledge by fixing unit tests.

I am on the same boat. I think you also want to take a look at Python challenge: http://www.pythonchallenge.com/

I would definitely recommend Neckbeard Republic. https://www.neckbeardrepublic.com/

Programmingresourc.es may have resources that are of use.


core python programming and core python application programming are two good (not free and a bit old) intermediate python books.

Think complexity is a free python book on algorithms and science.

Python 3 Object Oriented Programming is a very good book (not free) on OOP.

read python requests module.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact