a Python person's experience with Ruby

Steve Howell showell30 at yahoo.com
Sat Dec 8 00:08:01 EST 2007


Python is my favorite programming language.  I've used
it as my primary language for about six years now,
including four years of using it full-time in my day
job.  Three months ago I decided to take a position
with a team that does a lot of things very well, but
they don't use Python.  We use Ruby instead.  I'd like
to share my observations about Ruby, because I think
they say important things about Python, which has been
my frame of reference.  

First of all, I actually enjoy programming in Ruby. 
Although I'm still fairly early on the learning curve,
I feel like I've achieved basic fluency, and it
generally stays out of the way.  

(A quick disclaimer is that some of the observations I
make about Ruby may simply reflect my ignorance about
the language.  I'm still learning it.)

The thing that I like least about Ruby is its
"require" mechanism.  Basically, when you do "require"
in Ruby, it sort of pollutes your namespace.  I much
prefer Python's explicitness.

Some surprising things that I like about Ruby:

  1) It has the Perlish natural language syntax of
"raise 'foo' if condition."  I never missed having
that syntax in Python, but now that I have it in Ruby,
I use it quite often.

  2) On a general note, Ruby is enough like Python
that it doesn't bend my brain.

  3) I actually like being able to omit parentheses in
method definitions and method calls.  In Ruby you can
express "add(3,5,7)" as both "add(3,5,7)" and "add 3,
5, 7."  The latter syntax is obviously more error
prone, but I don't think I've ever actually gotten bit
by it, and the code appears more clean to me.

  4) Ruby forces you to explicitly make attributes for
instance variables.  At first I found this clumsy, but
I've gotten used to it, and I actually kind of like it
in certain circumstances.

What I miss about Python:

  1) I like the fact that Python's syntax for passing
around methods is very natural. Ruby's syntax is much
more clumsy.

  2) I miss indentation.  I get bitten by kEnd in Ruby
all the time.

  3) I miss Python's maturity.  Just to give a small
example, Python's interpreter gives more readable
syntax error messages.

Those are the things that jump out for me.  I'm
curious to hear what other people have learned about
Python after maybe going away from it for a while.




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the Python-list mailing list