2003-08-09T21:12-0700 py vs pl

I've got a new medium-sized project to be working on. It's just me coding it at the moment but at some point (if it comes together), I do want to be able to pass it on to someone else, preferably without apologising first.

I'm utterly torn between Perl and Python. My first choice in this case would be Python, because bad Python code doesn't seem to be quite so personal. I've seen people spit blood at other coder's Perl, just because it's not the way that they would do it. Perl demands rather more sympathy with your predecessor than does Python. With Python, it's just more code to stare at.

That said, your successor does need to actually know the language. Most of the people I can imagine maintaining this code will know Perl but not Python. Python doesn't take that long to learn, but reading Python to take on someone else'se project just isn't much *fun*. Sitting down to learn someone's Perl, while tough, does teach you about the way they were thinking when they wrote the application. Python's clarity, I think, cuts down on its expressiveness in depicting why certain decisions were made. When I had to hunker down and learn POE or Moveable Type, for instance, I came away with a very deep understanding of how it was supposed to work. It was fun, albeit time-consuming. I sometimes have problems doing the same with slabs of Python code, just because they can be very lacking in personality.

That said, I'm not paid to be a programmer. What is fun is a hobby can be skull-crackingly frustrating in a job with a deadline.

I eventually made the decision to go with Perl and Mason - mainly because of Mason. I know a lot of people who know Mason who I can ask when I got stuck, and there's a fair bit of this code that will end up being on a Website, eventually. There don't seem to be any Python templating solutions that stand head-and-shoulders above the crowd (and whose implementors I know). I felt that going with Perl would provide my successor with a clearer understanding of the whole project, and not necessarily lock me into an immature Web tech that no-one knows.

Now, a couple of days into it, I've begun to seriously reconsider. I'm nowhere near the Mason bit of the application, and I'm getting continually bogged down in Perl style issues that really don't have anything to do with what I'm trying to write.

To be honest, I think this is my Perl rustiness kicking in; and I think it may go away after a few more days hacking. Worse, though, is the effect of something I thought would be a real boon - CPAN. There's a bunch of useful utilities there that I'd love to suck in and use in my program. But they all have different idioms - all of which I have to sit down and learn. Plus there's the whole dependency issue: sooner or later I'm going to have to install all of this on the working server, and there's a real penalty to be paid for being dependent on a lot of scattered Perl modules. Will they work? Will they still be maintained? Which of alternative implementations should I choose?

So, I'm going to spend this weekend having a bash at a Python version. My XPish working style has recently become dependent on a lot of Python features, and the Python core library has most of what I need in the way of modules. I really haven't written much code, so there's not much time lost. And I figure that if it all goes to hell in Python too, I'll learn my lesson quickly and go slinking back to Perl with my tail between my legs. Plus, no-one's paying me to be decisive here. As if anyone would.

I still don't know of a good, solid, Python templating language though. Or rather, I know of three or four, but I don't know anyone who has used any of them seriously in high-volume production environments. I'm not interested in Zope or Twisted (tempting though they are) because I'd be obliged to wrap my solution in their terms, but I really don't know whether I should go for SkunkWeb or WebWare or Spyce or any of the others.

Right now, I'm delaying the decision until I'm a bit deeper into the code. Which feels a bit uncomfortable. But under the terms of XP, perhaps forgiveable.