Python v Ruby Celebrity Deathmatch

Snort a Sprocket: Bray on Ruby (and a few thoughts of my own)

Unicode. I do a lot of text processing; not having "Unicode Inside" would make my life difficult. But that's what I'd call a transient difference. Ruby code could have proper Unicode Inside and probably will by the looks of things. When that happens a ton of applications will break and there'll be years of weeding out unicode/byte interpolation errors. Python developers are still dealing with this, years after Unicode strings were introduced. But its worth it. Unicode today is a tactical advantage, but not a strategic differentiator.

Threads. I used to do a lot of multithreaded/concurrent programming, and fwiw, neither Ruby and Python are at the races on that front compared to java or C#. The next big short terms deals in concurrency will be whatever Java and C# do and what idioms crystallize around the Java 1.5 memory model. Long term with all these multicore chips we'll need an alternative altogether to "shared state concurrency" (which is what most people understand by threads) ie something like Erlang processes. What Python or Ruby do around concurrent programming is neither here not there to me.

DSLs. Usually, to understand what a DSL does or means is to go and look at how it's implemented. Very very few DSLs are formally, or even, well defined. That includes Rails. I wonder about the wisdom of letting non-language designers access to language design tools. Python code I've seen doesn't really work in terms of DSLs, but its no odds to me.

Libraries. This is where Python is head and shoulders above Ruby. But again it's a transient difference. if enough people show up with code, Ruby will get libraries. It's perhaps unfair to say that most Ruby devs are in fact Rails devs and core library coding isn't on their radar. Most insightful to me was when Sam Ruby reverted to Python for Venus.

Objects. In Ruby everything's an object. That's good, I like objects, and I wouldn't miss Python's 'self' if it went missing - but I'm a multi-paradigm type, so the argument that everything should be an object mostly goes over my head.

readability. For me, it's too early to determine if readability is a differentiator. Rails isn't especially readable, but it isn't old enough either. It's accepted that Python results in readable code. The thing is that both languages provide features that can make code incomprehensible - these are the same features that make them hyper-productive in small/mid scale projects. For example I think anyone in the Ruby community who thinks mixins are the killerest needs to survey a big codebase like Zope2 and see what it does with monkey patching and setattr. [actually every rails hacker should look at Zope2 - bonobo is the original OO publishing system for the web]. Wise java programmers see that langage's relative inflexiblity as a feature - yes there's a lot of syntax cruft, but you have to use mucho reflection and go hammer and tongs with a patterns book to make Java code truly surreal.

Layout and typography. I don't know what Tim is on about around typography, but typography to me means means the arrangement, choice and presentation of symbols for conveyence. If Python used emdash and Ruby used ndash to represent the minus operator, that would a typographical debate of merit. But it certainly does not mean debating 'end' v 'self' - that's lexical, not typographical. The main typographical distinction between the languages is whitespace significance. To me, as a working developer, you always use whitespace anyway so 99% of the time it's irrelevant that Python whitespace really matters to the interpreter. Indeed most of the time it's a benefit, as it short circuits stupid arguments about code layout. The one place whitespace is a problem is that real lambdas seem to be off the table for Python; that is a technical deficiency.

In short, there's just not enough fundamental differences between the two languages to really matter. if you're wedded to one of them and need distinctions to justify your aesthetic disposition, fair enough, but for what it's worth, "I like it" is an ok thing to say - you don't have to go all Paul Graham and try to rationalise or moralise your sense of the beautiful. If you have chosen one over the other and are thus commercially invested in a code base or platform that's fine too.