Python Provocation

October 2, 2010

Posting slowed down a bit recently. A few life difficulties took precedent followed by almost two solid weeks of chairing the Astronomy Grants Panel. Doesn’t feel right to write about that in any detail for obvious reasons, but I will just say that this article in THES suggesting that we would better off with a lottery is a complete pile of dingo’s kidneys. Maybe I will work up on a post on that, as it made me cross.

But maybe I am just in tetchy mood.  I am even falling out of love with Python.

Being a chap of a certain age, I spent a long time stubbornly persisting with Fortran until it got too embarassing to admit. So I mugged up C. Pretty good, but didn’t feel right. Next up Java. Hello World etc. Java was just too strict and boring and pernickety. Engineer’s language really, not a scientist’s language or a hacker’s language. All that object oriented stuff. Mystical mumbo jumbo. I like algorithms ! Give me procedures !!!

I was getting fed up. Then someone said “try Python” and reluctantly I did. Then, lo, all was warmth and happiness, and the light shone upon the face of the deep. It was easy and flexible, and object oriented but not so you really noticed. You could use it interactively, or write simple scripts, or build massive symphonies if you wished. It came with all sorts of internet goodies built in. Most important, it was extensible and had community backing. Numpy/Scipy seemed the right thing to back, and astro stuff was appearing.

But it still seems a bit ugly, and I have to keep a big notes file full of tricks and reminders of how to do things, cos somehow it doesn’t stick from one month to the next unless you keep using it. Installing and updating stuff is getting gradually easier, but still clunky. There are weird incompatibilities between one version and the next within 2.x, whereas you’d have thought the 2.x world should have been completely backwards compatible, with 3.x becoming a new world. I hear from some developer contacts that this is even more of a problem for key packages like Scipy, with quite frequent changes to the API which mean that your scripts keep breaking.

Then of course there is the speed thing. One of my favourite packages is Pyxplot, a kind of re-imagining of Gnuplot. (I will be writing a post about this and other plotters sometime soon..) Pyxplot used to be written in Python, but the latest version has been completely re-implemented in C. I asked Dominic Ford why, and he explained that it was now ten times faster and took a tenth of the memory. Hard to argue with that.

Python occupies a strange territory between the easy peasy world of “download this app and start clicking” and the stern world of “if you don’t know what a makefile is, you’d better look somewhere else mate”. At first I thought this was precisely its strength : grown up stuff for busy people. But now I ain’t so sure. Neither use nor ornament, as EG used to say.

Over to you Ross.

Advertisements