What's better about Ruby than Python?

John J. Lee jjl at pobox.com
Mon Aug 18 18:48:07 EDT 2003


Alex Martelli <aleaxit at yahoo.com> writes:
[...]
> of each block (rather than just unindenting) -- but then I do get 
> to avoid typing the equally-silly ':' which Python requires at the
> _start_ of each block, so that's almost a wash:-).  Other syntax 
[...]

I'd never noticed that.  Greg Ewing has pointed out a similar trivial
wart: brackets and backslashes to get multiple-line statements are
superfluous in Python -- you could just as well have had:

for thing in things:
    some_incredibly_long_name_so_that_i_can_reach_the_end_of_this =
      line

where the indentation of 'line' indicates line continuation.


> Others no doubt base their choice of programming languages on just 
> such issues, and they generate the hottest debates -- but to me that's
> just an example of one of Parkinson's Laws in action (the amount on
> debate on an issue is inversely proportional to the issue's actual
> importance).

The differences between Ruby and Python are, in the end, about as far
from significant as it's possible to be (near as I can tell from
everybody's comments, that is).  Which is why Ruby's very existence is
a bit sad -- you could almost regard it as a code fork, except that
the author forgot to start with Python's source code ;-)


[...]
> I do understand why others would thing otherwise, even though
> I could hardly disagree more vehemently with them:-).

Thus proving your own point about the inverse importance / volume
relationship ;-)


[...]
> Ruby does have some advantages in elementary semantics -- for
> example, the removal of Python's "lists vs tuples" exceedingly
> subtle distinction.

You may be right there.  Guido's comment that tuples are mostly
mini-objects did clarify this for me, though.


> But mostly the score (as I keep it, with
> simplicity a big plus and subtle, clever distinctions a notable
> minus) is against Ruby (e.g., having both closed and half-open

In the end, though, don't you agree that any such judgement is, from
the pragmatic point of view, pointless once you realise how similar
the two languages are?  If somebody sneakily switched Python and Ruby
in the middle of the night (so that suddenly many more people use
Ruby, and much more code was written in Ruby than in Python), you'd
stick with Ruby, wouldn't you?

[...]
> about undistinguishable to anybody and interchangeable in any

*in*distinguishable.  Ha!  I found a bug.

[...]
> If I had to use Ruby for such a large application, I would
> try to rely on coding-style restrictions, lots of tests (to
> be rerun whenever ANYTHING changes -- even what should be
> totally unrelated...), and the like, to prohibit use of this
> language feature.  But NOT having the feature in the first
> place is even better, in my opinion -- just as Python itself
[...]

I mostly agree, but I think you could be accused of spreading FUD
about this.  Does anybody *really* choose to alter string-comparison
semantics under everybody else's nose in Ruby??  That would be like
doing

import some_module

def evil_replacement_function(): return blah()

some_module.important_function = evil_replacement_function


in Python, wouldn't it?


John




More information about the Python-list mailing list