Tuesday, August 20, 2013

Python as Basin

TL;DR: I am saddened but resigned to not hacking on tree because it's written in C.
I've often said that the only thing wrong with Python is that it ruins you for other languages.

What I mean is that nowadays, having written software mostly in Python for the last few years, when I go to read the source code for a simple tool like the 'tree' program (which reads a directory structure and outputs a simple text-mode graphical "tree" representing it) which is written in C I am struck by the amount of work I would have to do to be able to consider myself a "C programmer". (I used to be unembarrassed to claim "I can write C code." No more.)

Using Python has made me become monolingual.

I'm not suggesting that Python is "the best language" or anything (after all, we all know Forth is the best language...)  I'm just comfortable leaning on it heavily and neglecting other languages.

This is an old folk's liberty.  You young coders better learn as many languages as you can, it's not as hard as it seems and it's the only real way to escape the nest of abstractions that ensnares the unwary specialist.

(Put it this way: Yes there are more Java programmers than Python programmers but don't let that prevent your shop from deciding to use Python because a programmer who knows Java but can't pick up Python should not be hired! That's a baaad programmer! I would never dream of hiring someone to write software who knew Java (or C++) but balked at learning Python.  That poor bastard can go polish his turds on someone else's dime, Real Programmers only here please!)

So if language-agnosticism is so important to identify good programmers why am I so comfortable "degenerating" into monolingualism?

Well, for one thing, the characterization is false: I am still reading about and learning new languages. I just tend not to use them (other than for toy programs to play with them.)

At this stage in my trajectory as a programmer (which is much deeper and more important to me than my career as a programmer) most languages won't have much to teach me.  They also wouldn't enable me to achieve things at work that I otherwise couldn't achieve [with Python].

They are still fascinating. (I read "The Go Programming Language Phrasebook" cover-to-cover, drooling, just for kicks.)  But the romance has worn thin.

I want to get things done and I can do that with Python faster and with fewer errors (and fewer trips to the documentation) than any other available language (plus "ecosystem".)

There are sweet spots though when it would make sense to us another language.  If I had to write high-performance low-level software (instead of the endless succession of poorly-thought-out Django apps that have been buttering my bread for the last few years) I would lunge for Go.  It is a wonderful language and seems to me to be very well-designed.

I am less sure of the niche (for me) of Rust or Dart or (shudder!) Coffee script.

What I think we are experiencing in the field right now is a kind of shift from programming by language to programming by concepts.

The process of translating a high-level language into efficiently-runnable form is already so intricate and esoteric that it pretty much must be left to the crunchiest and most capable of us.  To put another way, it is very unlikely that a newbie is going to make significant contributions to a byte-code or assembly optimization process, but all-too-likely that newbies will inflict new languages on us (e.g. Ruby and PHP, both created by people who really had no business trying to create new programming languages.)

To me, this indicates that the "innovation-space", if you will, for PLs has to do with expressing ideas clearly, rather than some spectacular new syntax or nifty whiz-bang feature.  It is no fun watching languages slowly recapitulate LISP.

Let your language describe what you are thinking and let the accumulated wisdom and sweat and tears of the brilliant people working on translation and new hardware design turn it into efficient, runnable form.

In this regard Python is very satisfying.  It is possible to write very elegant and expressive code in Python. Readability is always the first thing on the list when I'm enumerating Python's strong points.

The PyPy project is beginning to provide a robust and powerful way to use Pythonic code in ways that are very flexible without sacrificing rigor.  (This is not to say that similar efforts aren't proceeding for other languages and "ecosystems"!)

I'm looking forward to the day that PyPy can convert my Python code into something like native code. (And of course there are tools like Cython.)

I only have so many hours in a day to devote to my craft, I can only burn so many calories to produce thought-stuff.  It made good sense to learn and use several languages when I was "coming up".  But now that I've "arrived" I find it makes more sense for me to improve by means of deep mastery of a particular set of powerful tools, rather than continuing to grok yet more variations on what I already know (syntax of languages.)

Learning Category Theory is more likely to pay off, personally and professionally, than learning Rust or Julia.

No comments: