Friday, December 23, 2005

'Why Python?' revisited

I've just read this pretty good post by Ben Bangert. It's a welcome respite from all the 'ruby's soooooooo great!!!' posts and books that have kept popping up everywhere recently.

Don't get me wrong - I like Ruby. Its a dynamically typed language and dynamic rulz! ;-) I would much rather use Ruby or Python than Java/C#/C++ for general purpose programming. Its great that Ruby has a framework that has pushed it into the limelight. If you're comparing Rails to programming in the various Java web frameworks or ASP.NET, its a walk-over; you've got a massive productivity win, irrespective of IDE support.

But when using Rails to compare Ruby with Python, its helpful to remember that Python already has pretty good web/internet-based frameworks: e.g., Zope and Twisted are well established; others like TurboGears, Django, and Webware are newer but show the extent to which python has been successfully applied in this domain. Each of these is pretty good, they have a different approach to building web applications, but this diversity is good. Some of these (e.g., Zope, Twisted) are much more than mere web application servers, and attempting to evaluate them on how easy it is to build and deploy a simple db-driven website would be a mistake.

In addition to web frameworks, python has interfaces to useful third-party APIs (e.g., PyGame, wxPython), time/money saving products (e.g., reportlab, trac) and unparalled support amongst dynamic languages IMHO for being used a wrapper over existing C++/C code, thanks to the like of Pyrex, Boost.Python, and SWIG. The latter has both Ruby and Python bindings

As Ben points out, Python is used in lots of places. One of these is Google who 'have used Python right from the beginning' and have just employed the BDFL. Many of these places use Python, not because it lets them write web apps quickly, but because in a large code base, Python's clear syntax leads to enhanced productivity and benefits long-term maintenance. The maxim

" Code is more often read than it is written"

becomes more important. For me, Python just about (!) edges Ruby on that one, although I'm open to being proved wrong.

No comments: