Comparison with Ruby ?

Juergen Bocklage juergen.bocklage at
Wed Feb 21 18:00:46 EST 2001

Aehmmm, I'm just a beginner, but some remarks on the ruby-python

Python and Ruby deal with similar problem areas. Now, let's compare
Python with Ruby:

     Ruby uses conservative statement structure, using `end'.
JB> Python syntax is the best I ever saw, indenting is just smart.

     You don't have to say `self.' to access attribute of the object.
Ruby's instance variables are prefixed by "@".
JB> Then I prefere self. It's more descriptive.

     Python separates types and classes, while Ruby treats them the
same. Python types are more limited (no
     inheritance/subclassing; cannot add methods to existing types).
JB> Don't know

     Ruby has a better (or "real") closure feature.
JB> what does this mean

     Object attributes are not accessible by default in Ruby.
JB> That's bad. Wrinting __ in front of a instance attribute, is okay
for me.

     Ruby converts small integers and long integers automatically.
JB> Okay, nice for you

     Ruby does not have tuples.
JB> Bad for Ruby. They are fast.

     Statements in Ruby have values; you can say

          def max(a,b)
            if a>b then a else b end
JB> Where is the return? How can someone see when sth. is returned?

     Ruby has more natural operator overloading; e.g. you can define

          def +(x)
           self.to_i + x

JB> I know this from C++, (Syntactical sugar or a good source for

     Ruby uses mark-and-sweep GC, unlike Python's ref-counting GC. So
          No INCREF, DECREF are required for extensions.
     Extensions for Ruby written in C/C++ can easily define Ruby
     Ruby has a loop abstraction using block; e.g.

          10.times do

JB> What's this?

     You can define your own arbitrary iterator.
JB> Why?

     Ruby's block for method can be used more than iterator; e.g.

          mutex.synchronize do
            .. critical process ..

JB> Don't know

     Ruby provides method combination using `super'.
JB> this is a good feature, in python I think you have to use the name
of parent class.

     Ruby is often faster than Python.
JB> Often??

After a short look at the language I have to say, python is much more
self explanatory then ruby. Also this parenteses less calling of
methods, does not look good. Looks like calling an attribute.

Python is for me the language for beginners and designers.
I teached my flat mates in one eveing how to prototype there C++ app.
with python. They where just ;-)) and concentrated on the design.

- See ya JB

"Florian W." wrote:

> Hi Python-Fans !
> A friend told me about the programming language "Ruby".
> It's seems that it's a fine one.
> Will the high number of features shrink the Python-community to
> a very low amount ?
> Mfg Florian

Juergen Bocklage
mailto:juergen.bocklage at

More information about the Python-list mailing list