Jul | AUG | APR
| 20 |
2007 | 2008 | 2009

2 captures 20 Aug 08 - 30 Apr 09 |

Close Help

# sjs

## geeky ramblings

## Python and Ruby brain dump 0

Posted by sjs
on Wednesday, September 26

It turns out that Python is the language of choice on the OLPC, both for implementing applications and exposing to the users. There is a view source key available. I think Python is a great choice.

I've been using Ruby almost exclusively for over a year but the last week I've been doing a personal project in Python using Storm (which is pretty nice btw) and urwid. I'm remembering why I liked Python when I first learned it a few years ago. It may not be as elegant as Ruby, conceptually, but it sure is fun to code in. It really is executable pseudo-code for the most part.

I'm tripping up by typing `obj.setattr^W^Wsetattr(obj` and `def self.foo^W^Wfoo(self` but other than that I haven't had trouble switching back into Python. I enjoy omitting `end` statements. I enjoy Python's lack of curly braces, apart from literal dicts. I hate the fact that in Emacs, in python-mode, `indent-region` only seems to piss me off (or `indent-*` really, anything except TAB). I really like list comprehensions.

The two languages are so similar that at a glance you may think there are only shallow differences between the languages. People are always busy arguing about the boring things that every language can do (web frameworks anyone?) while ignoring the interesting differences between the languages and their corresponding ecosystems.

Python has more libraries available as it's the more popular language. The nature of software written in the languages is different though as the languages themselves are quite different.

Ruby has some Perl-ish features that make it a good sysadmin scripting language, hence we see nice tools such as Capistrano and god written in Ruby and used by projects written in other languages.

Python is faster than Ruby so it is open to classes of software that would be cumbersome in Ruby. Source control, for example. You can write a slow SCM in Python though, as Bazaar demonstrates. You could probably write a passable one in Ruby as well. If it didn't quite perform well enough right now it should fare better in a year's time.

I still think that my overall joy is greater when using Ruby, but if Ruby isn't the right tool for the job I'll probably look to Python next (unless some feature of the problem indicates something else would be more appropriate). The reason I chose Python for my current project is because of libs like urwid and I needed an excuse to try out Storm and brush up on my Python. ;-)

- Tags: python ruby
- Meta: 0 comments, permalink

##### Comments

Leave a response

Comment

Name:

Email Address:

Website:

Comment: