Experiences with Ruby?

Johann Hibschman johann at physics.berkeley.edu
Mon Apr 23 16:11:28 EDT 2001


-11,3-3562,3-3076  writes:

> I am interested in hearing from anyone who is using Ruby or Python to
> implement medium-sized programs.

I don't have much experience with Ruby, but maybe the threading
differences are enough to point you to one or the other.  Python uses
native threads, Ruby uses user threads.  If you get stackless python,
you can have user threads with python, but it's not the standard
implementation.

As to ease of extending, I'd have to say that I think Ruby's a bit
easier, as long as your objects can live with the garbage collector.
It's simple.  You just wrap up a pointer, assign it a class, define
constructors, destructors, and any methods you need, and go from
there.  Python types are a bit more complex.  Of course, this is only
important if you need to write your own C modules.

Python has a more robust body of external modules, which may or may
not be useful for what you want to do.

For developing, I find Python to be a bit more convenient, mostly
thanks to doc strings.  If I forget the order of arguments, of, say
string.split, I can just ask the system.  Ruby doesn't have those.

Ruby also doesn't have keyword arguments, or at least not very
convenient keyword arguments.  I might be silly, but this is the most
irritating thing about Ruby for me, given the exploratory coding style
I tend to use.

It seems more possible to write "crazy magic code" in Ruby.  This can
be useful, sometimes, but sometimes it can lead to trouble
understanding the code when you look at it in six months.

In any case, you can't really go wrong.  I've been using Python for a
long time now, and I'm not about to switch to Ruby for my main system,
since it doesn't really offer me anything new.  I've been using Ruby
as a Perl substitute, since it provides me with the same command-line
text-munging features, without quite so much weirdness.

-- 
Johann Hibschman                           johann at physics.berkeley.edu



More information about the Python-list mailing list