Python and Ruby , object oriented questions

Niklas Frykholm r2d2 at mao.acc.umu.se
Mon May 14 04:25:07 EDT 2001


In article <3AFDFC02.29C58D14 at earthlink.net>, Ron Stephens wrote:
>1. How difficult to learn is Ruby, compared to Python?

Slightly more difficult, I would say. The syntax is a bit more complicated
and you have to learn about iterators sooner (not that there is anything
wrong with that :).

>2. Is object oriented programming easier to learn and use in Ruby than
>in Python?

Nah. It's the same. You might argue that Ruby takes OO a bit
further, while Python is more of a mix of OO and procedural style. But this
is mostly on superficial issues, such as whether to call s.length 
or length(s) (yes I know that Python now supports the former) and whether
self is implicit (it is in Ruby).

>3. Can someone give me a list of disadvantages of using Ruby, compared
>to Python? I am looking for reasons to avoid learning Ruby.

Python has better documentation (at least if you don't read Japanese), more
third party modules, is more mature, is faster (in my experience), has no
fundamental syntax problems.  (In Ruby's more flexible syntax --- the semantics
of a program can, in some weird situations, change if you put a space in the
wrong place.)

That said, I should also say that I love Ruby, for its consistent OO'ness,
creative use of iterators, accessor functions, conciseness, ease of extension,
mix-ins, etc. I cannot see why anyone would want to avoid it.

BTW, I wish that people who don't know what they are talking about would stop
claiming that Ruby is too Perl-like to use: "I've never actually programmed in
Ruby, but it looks a lot like Perl, so it must be bad." While Ruby has borrowed
some features from Perl, it hasn't borrowed any of the bad and ugly features
Trust me, programming in Ruby is NOTHING like programming in Perl.

>Ruby
>attracts me because, reading the Ruby book in the Barnes and Noble
>store, it appears that the object oriented nature of Ruby is
>extraordinarily clean and simple to understand, whereas the object
>oriented aspects of Python are a little difficult for me.

I'm not sure what it is you find difficult with OO Python, the differences
are mostly syntactical. But the "pickaxe" book is great reading, I can
really recommend it.

>Why waste my time on Ruby??? Help me
>close me ears to the siren call of a mutant language that threatens to
>cause me to prostitute my pure, if not chaste, love for Python....

Ah, but time spent learning is never wasted. And programming languages never
get jealous. Get acquainted with them both and then follow your heart.

// Niklas



More information about the Python-list mailing list