Well, after Dan’s Python presentation earlier this week, I decided to give Python another go, and attempt to properly evaluate the two.
Python Pros:
- Faster than Ruby, at least until Ruby 2.0 with YARV is released.
- Looks cleaner, because there are no end statements all over the place.
- More library support.
- Python 3000 will use UTF-8 internally—no more faffing around converting, no more having to mark every file I write with -*- coding: utf-8 -*- so I can use copyright symbols, no more obscure errors trying to process reST (I know that it isn’t an ASCII character, I never claimed it was!).
- Ruby doesn’t have a native implementation of reST. I like reST, as a text markup language; it seems less frivolous than markdown.
Ruby Pros:
- .each{} is nicer than for i in j:. On the other hand, Python has list comprehensions, which can be even nicer.
- No need to type () unless not doing so would be ambiguous.
- Blocks are more powerful than Python’s lambda, though lambda looks cleaner (compare lambda {|i|i*i}.call(4) to (lambda i: i*i)(4). Python lambda can only be one statement, though.
- More objecty goodness—I like having everything as an object. I also greatly dislike having some stuff as methods and some as functions, like Python does—either go entirely OO or entirely not.