[Tutor] Python and Speed

alan.gauld@bt.com alan.gauld@bt.com
Wed, 18 Apr 2001 18:39:49 +0100


Sorry for the false send, I'll try again :-(

> > their code falls about midway between Perl and Python
> > in speed, but retains the readability of Python.
> 
> Personally, I would say the Ruby site is wrong. Ruby is NOT a 
> readable as Python for a newbie. 

I don't think it's far off. Ruby is certainly much 
closer to Python than it is to Perl syntactically 
- despite the comments you cited. I think those are 
designed  to attract Perl programmers!

What Ruby does have is, like Perl, builtin regular 
expressions. That makes most regex activities 
noticably faster than Python. Otherwise I don't 
honestly see any difference in general programming 
between Ruby and Python. I do find Perl is usually 
slightly faster than either, but only a few percent.
Certainly not the hundreds of percent claimed by 
the Perl zealots.

> "Ruby's syntax and design philosophy are heavily 
> influenced by Perl."

I don't understand this comment, other than as sales 
pitch. Ruby is readable, Perl isn't. In fact about the 
only Perl like syntax I've seen is the addition of '@' 
in front of instance variables

class Foo
   def initialize(i)
      ....
      @var = i
      end
   ...
end

f = Foo.new(42)

Doesn't look much like Perl to me! In fact it 
looks rather a lot like Python... :-)

> "Ruby is much more complex than Python but its 
> features, for the most part, hang together well."

It has a more complete and consistent object model
but otherwise I wouldn't say it was much more "complex".

Alan g