I don't know Ruby very well. What I have heard from others tells me that I probably wouldn't prefer it over Python. Python has made me value clarity, explicitness and conciseness over pure expressive power; they have different values[^pep-20] which are certainly both valid in their own ways, but nevertheless are different.

Pylons is proving to be a solid web development framework, but being an amalgamation of third-party modules, there are parts of it that are, unfortunately, lacking. There are two, in particular, with bad documentation, awkward usage, and un-Pythonic idioms - assuming they have idioms worth using at all.

To name names: Routes, and WebHelpers.

No offense to the authors (really!); they're just sore thumbs. There's a reason for this. The common thread joining these two modules1 is that they are attempts to port Ruby on Rails components to Python Frameworks. It's awkward - and it shows.

This is something that Django does very well. It's a Python Web Application Framework, and as such, the Python in it idiomatic, clear, and familiar. That being said, the level of coupling in Django is a problem, but there is no doubt in my mind that the URL configuration, for example is better done2 than in Routes.

One aspect (bug? feature? Both?) of Django is that there is no built-in AJAX. The Django devs have their reasons for this, such as not wanting to cause JavaScript Library wars, but it has the end result of making AJAX in Django a very much roll-your-own feel. WebHelpers, then, doesn't have a very high standard to hit. It just has to do better than nothing - and I'm not sure it does! Using a separate, AJAX controller and jQuery, I had a dead-simple AJAX solution (that worked). The code wasn't integrated into the framework, I'll admit. The thing is, though, that jQuery makes AJAX & DOM manipulation so incredibly painless that there wasn't enough code to make abstraction of the AJAX calls needed. I don't think I had more than 6 non-comment non-blank lines of JavaScript for any of my pages.

The same is just not going to happen with WebHelpers / Scriptaculous. Scriptaculous (and Prototype, on which it is based) are excellent3 frameworks for DOM scripting - but that's the problem. DOM scripting is, as the jQuery home page puts it, tedious. JQuery excels at the kind of quick, dead-simple JavaScript that I had been using. Unless you're Google or Yahoo and building completely AJAX-based web apps, I think that simplicity of implementation outweighs framework integration. If you don't need to use a framework to do AJAX, don't; if you have to ask if you need one, you don't.


  1. Another thread joining them, in a bad way - WebHelpers depends on Routes for some parts of it's functionality. Buh-bye, loosely coupled! That being said, I'll admit I don't know how I would do URL generation without coupling. I probably just wouldn't. I have less than ten URL paths to worry about - why not simply implement URL generation methods in the class definition? This is the get_absolute_url() approach, and it works. 

  2. I also like that the controllers - called views in Django - are implemented as functions in a module rather than methods to an object. That was certainly how I thought of them, and the repeated controller name in Pylons violates DRY. DRY isn't holy, but it's nice, and I miss the religiousness that Django stuck to it with. 

  3. Not really. Not Scriptaculous, at least. I say excellent because for the purposes of the argument, they could be, and the point would still be valid. But I'm not fond of how Scriptaculous' home page in particular brings my computer to a crawl. The flashy, jittery home page is something I wish they had left in 90's. There's a reason they got rid of the HTML tags for that kind of behavior; why re-implement the same annoyances in (browser-freezing) JavaScript?