The Guru College
A Python For The Web
I’ve been learning Python recently at work. It’s a decent language that has been well thought out, and is honestly better suited to large projects than Perl, my language of choice. I hate to say it, but it’s true. As Rami pointed out recently, no language is good at scale if there isn’t a modern, commercially viable computer game written in it. Can’t think of Python’s example? EVE Online is written in Stackless, a Python variant. Likewise, I can’t find a shipping game written in Perl. If someone can throw me an example in the comments, I’d appreciate it. (No – not an engine with Perl bindings, an engine written in Perl, that has been a commercial success.)
That aside, getting into Python means needing a project. I have a couple at work that I’m juggling, but I’ve also got copious amounts of free time at night, with a toddler and all. So, I’ve been working with the web framework django. It saves a lot of time, like Python, as it’s really well thought out. The deeper I delve into it, the more I like it. I’m going to take a stab writing a photoblog in it, and I may even port my consulting-project-nagios code to it, as it lends itself better to almost all of those functions. (So, look for sites on http://gurucollege.homeftp.net/ again soon!)
The model-view-template ethos is deeply ingrained, and this in turn fits the model of web design and raid development fairly well. The default template system is straightforward and well thought out, and if you don’t like it, it can be replaced with TGenshi or a number of other Python template engines. As limiting as it is to have the SQL structures force-fed to you, in a way it’s also really nice. You never worry about INSERT versus UPDATE. You just call .save()
. You don’t have to write or debug SQL joins – it’s just a matter of Model.objects.filter(key='var')
. And while it’s a pain in the rear, you can work with legacy database structures.
Python and django aren’t perfect, and I’m not going to try to convert the guys at work over to it yet. But there are a number of places where it seems to fit in.