Saturday, October 01, 2005

Why PI?

Because I like it.

Primarily I like Python for the same reasons as Eric Raymond, which I would abbreviate as - it works for me: it is much quicker and easier to write working software with Python than any other system I have used.

And it works for others' - I started with Python about a year ago, and suddenly the promise that open source always should have had for me (that I'd be able to tweak others' software) is real.

Now that should not be a radical concept - that's what the basic idea of open source was - you get the source so you can change it. But somehow all that C++ code never encouraged hacking. Before you could hack the code, you had to find their compiler, their build system, their cuddly toy, their headers, their code convetions, their et bloody cetera. OK, ok, the cuddly toy is an exaggeration, but as a C++Builder user on Windows it is pretty easy to get the idea that Open Source is just not for me.

And then someone said I had to integrate Subversion with an issue tracker, and the next thing you know, I found an id3tag reader, and I was able to see coverage of my unittests so well I started re-thinking that continuous testing might be do-able after all, and, and, ... And for every one of these (and more) I think nothing of hacking away at the source and seeing the module improve before my eyes !

If I download a non-Python app, only to find it doesn't work, I abandon it and re-claim the disk space. If I download a Python app that doesn't work I make it work: fix it, adapt it, improve it.

I downloaded bicycle repair man a few weeks ago, and it didn't work with vim for me out of the box, so I fixed it. But I have more than that - I have a base that I can add to:
  • Wouldn't it be interesting if I could get that to talk to pylid?
  • Maybe I could re-write that half-finished Java attempt at Copycat in Python?
  • Sure, didn't the NEAT code come with SWIG wrappers attached anyway, so that is attachable too.
But all that is starting to answer the "Why AI?" question, which is for another day.

Python really opens sources because (IMHO) it is easily read, and easily written. And both of these are just as important.

It is easily written because it's "just obvious" to anyone with a few modern languages, and throws away so many silly syntactic sugars, without introducing many new ones (colons at eol are still a problem for me). In the past few months I have spent lots of time on the python doc pages, but the vast majority of that time was reading about the library, very little reading about the language.

And having both interpreter and editor always open is very helpful, especially when you can just "import myStuff", and call your own methods as you are developing them. Immediate feedback on how your ideas don't work is always welcome: I may not be old enough to have written Fortran, but I do remember (as a student) when compilation time of COBOL programs was "overnight", and we learnt as much VCL trying to get compile jobs to the top of the queue as we did COBOL.

Python source code is nearly as easy to write as ... Python test code.

With both doctest and unittest being part of the distribution I was writing test code very fast, nearly before the source code even. But hey - we don't want to get too extreme here :) Definitely a far more pleasant experience than hanging from the top of skyscraper with the the 800-pound gorilla that was CppUnit!

So far it was all going according to plan - well I guess Guido intended all of these effects, as they seem to flow directly from Python's structure.

But the less expected side-effect of Python being easily written is that it is well-written.

OK, ok, caveats galore, and it is a highly unrepresentative sample from my little corner of the net, but - all the Python source I have read in the last year, has been easy to read! So much so that it makes you re-wonder what "easy to read" means: One of my first "oooh...nice" reactions to Python was docstrings, and I still thank Guido for them daily when finding about libraries. But the source codes I've been viewing does not have any comments and they are well enough written that they don't need any.

Haven't quite figured this one out yet - it is too radical. May need an AI to help with this.

And, and, ..., and I don't quite use the exact same scripts to control XMMS (on Mandrake) and Winamp (on Windows, duh), but I'm nearly there and I will in a few weeks, I plumb reckon.


Post a Comment

Links to this post:

Create a Link

<< Home