Skip to content

Instantly share code, notes, and snippets.

@proxypoke
Created July 29, 2012 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proxypoke/3195346 to your computer and use it in GitHub Desktop.
Save proxypoke/3195346 to your computer and use it in GitHub Desktop.
Go read the source

Go read the source

I'd like to confess something.

In all my time coding Python, which I still consider my primary and favorite language, I haven't read much source code of the standard library, and never once taken a look at the internals of CPython. Okay, I lied, I once read the documentation about the sorting algorithm, Timsort, but that's about it.

This isn't because I dislike digging around in internals. I love the crazy stuff you can do with Python's object model, how you can dynamically screw around with pretty much everything whenever and however you want, I like the awesome builtins, the docstring system and the functionality of the included batteries.

But I never felt compelled to read the source of all this stuff. Maybe because I subconsicously thought that it was going to be extremely complicated - all this high level abstraction stuff surely must be mighty complex in its implementation. I don't know, and I even highly doubt that this is at all the case.

I can only speculate about the real reason, so let me instead offer a contrasting experience: my recent ventures into Go. I highly enjoy it as a language that lets me write fairly low level code without all the cumbersome cruft that C requires while still retaining the spirit (and productivity) of a high level, dynamic language.

But the most peculiar thing about Go is that I find myself regularly reading source files of Go packages, almost as much as I read the (quite excellent) documentation. And what's more - I enjoy it a lot (not that I hate reading code, I should do it more often).

I suspect it's a combination of coding at a similiar level of abstraction as the standard library is written in (I just started implementing parts of the coreutils in Go) and the philosophy of the language that "code is documentation, too", which I think is a very good attitude (notice the "too"; it's not that Go eschews real documentation in favor of "read the code", but rather that the code is part of the documentation).

I wish I could quantify it further, because this is, in my opinion, and extremely amazing feature any language should want. Reading code is important, and should be encouraged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment