Well, the weekend’s over, and I’m sticking with Python. I caught up to where I was with the Perl implementation pretty quickly, and in far fewer lines. To be fair, I think a sizeable part of that may have come from me using the Test::Unit / unittest suites to do my test-first development. Both are derived from Kent Beck’s Smalltalk framework and are very OOP-oriented, which favours Python over Perl5. I was beginning to stumble into some hairy data structures with Perl, all of which turned out a lot simpler-looking in Python. That, and I’m doing some email mangling in this part of the coding, and Python’s built-in email module has much of what I need. There are some even better libraries in CPAN (as usual), but I was greatly spoilt for choice and little spoilt for time.
Anyway, this still leaves the problem of a decent templating solution for Python. I got loads of very useful suggestions, which I’ll attempt to summarise here:
Aaronsw wrote back to say that he uses cheetah and sqlobject . He wrote back suspiciously fast. I think it may have been one of his bots talking. Both cheetah and sqlobject look tempting – especially as sqlobject supports sqlite, and I’d like to stick with that very basic SQL implementation until my lusting and hunger for relational database power become known to more people, as the Boney M song has it [1].
Noted real-world Python user Zooko said that the Mnet gang would probably be going for whatever templating Twisted had. Then he confessed that they probably wouldn’t have much need for templating at all. His most abiding point was, I think, to exclaim w00t python w00t, which I took to heart.
Jonathan Moore says “all the cool kids have quit templating and gone to XSLT”, which I subconsciously knew. But then if the cool kids jumped off the Post Office Tower, would I join them? Naturally, because cool people are usually into BASE jumping and stuff like that, and would be cool enough to help me with basic safety precautions. And, besides, how cool does jumping off the … I digress.
My thoughts: XSLT is one of those technologies best kept for either times when someone is paying you to learn it, or you’ve lied on your resume and said that you wrote the W3C spec, and now you find you have the job of your “dreams”. I’m in neither position, for once.
David Jeske wrote an informed recommendation for ClearSilver, which isn’t surprising as he’s been hacking on it for yonks. ClearSilver looks really interesting. It has a nice, simple, theory behind it. The original, closed-source version drives Yahoo Groups . Jeske and friends’ open source re-implementation is used at PyMeld too, but wasn’t sure if it could cope with high-performance sites. Richard Jones likes SimpleTAL.
When I hit my templating problems, I think I’ll hit them back with either ClearSilver or Cheetah. Which one will depend on the size of my problems and on what speed I’m plummetting into disaster at the time.
[1] – Rasputin would make a great name for an open source project.