[Tutor] Re: Python vs. Ruby

Andrei project5 at redrival.net
Wed Oct 29 19:07:31 EST 2003

Daniel Ehrenberg wrote on Wed, 29 Oct 2003 14:25:21 -0800 (PST):

> What are the advantages of Python over Ruby? They both
> look pretty good sytactically. Python seems slightly
> more readable, but that's probably just because I know
> Python. Ruby does have annoying end keywords, but in
> Python, you have to write "self." before every
> variable within a class, whereas in Ruby you just

Not if you don't want that variable to stick around for very long :).

> prefix it with "$". 

I too have looked at Ruby (and I still look at it :)), not very long after
I started Python, so my view of it is not that of an expert, nor that of
someone who already knew Python before trying Ruby. Python won, despite the
two languages being quite similar for most practical purposes as far as I
can tell.

It's true that you don't have to do that self. stuff (though in python you
can use e.g. s. if self. is too long for you), but I don't think the use of
@, @@ and $ is an improvement at all. In fact, being a touch typist, I
think I can type "self." just as fast as or faster than "@" and I'm sure I
can type "s." faster than "@". Plus those annoying ends in Ruby that you
already mentioned. What I really liked in Ruby was that you can change the
built-in types, so that e.g. adding two integers would return their average
(or whatever). Obviously this is very cool, but not particularly useful I'd

Ruby however has some large disadvantages on the tutorials/tools field as
far as I can tell. The Python standard library and additional modules/tools
are simply amazing. Not that Ruby doesn't have anything, but Python has so
much more. Zope, wxPython, PyQt, PyGame, lots of tutorials for all levels,
lots of good editors/tools (Spe, Boa, wxGlade, PyCrust - hm... that all
kinda depends on wxWindows :), PythonWin). 
For ruby I found one Windows-only solution called RDE which is pretty good,
but is programmed by someone who apparently doesn't know a lot about
interface design and one called FreeRide which looks nice, but is rather
buggy and a bit lacking in the recent releases department. 

Python docs are a lot better too, especially the ones in the ActiveState
distro; the there isn't even a "docs" entry in my Ruby program group!
Another advantage is that the whole of Python is quite English-oriented,
while a lot of Ruby stuff is still in Japanese only (at least I presume
it's Japanese), or really broken English. 

You'll also find Python in more places than Ruby. From the Jython
interpreter embedded in e.g. Jedit to Jasc software that uses Python for
scripting. So Python knowledge has the potential to help you in more places
than Ruby knowledge.

Another diff seems to be that Python is faster than Ruby. Not that it
really matters in scripting languages, but thought I should mention it :).
Saw that on some language shootout page.

> Ruby typically writes shorter
> code, and I think that's pretty important (it's
> partially why I chose Python).

If you like that, you should see Perl. I've been told it can solve the
mystery of Life, The Universe and Everything in just one byte of code :).

Nevertheless, Ruby does seem like a nice language and if Python wasn't
around, I'd probably hang around on the ruby-tutor list now (oh, wait, that
doesn't exist :)).



Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5 at bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V
ernq gur yvfg, fb gurer'f ab arrq gb PP.

More information about the Tutor mailing list