Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] ruby and python in Japan




OK, I might have been a bit uppity at the time so I will try and reply with a bit more information. Although, there is a member in this list who came from a Python background, but who now like Ruby a bit more. I am hoping he will speak for himself on this topic (hint hint).

On Mon, 26 Feb 2007 17:29:47 +0900, Stephen J. Turnbull <stephen@??> wrote:

Zev Blut writes:

Anyway, I'm not arguing from information, I'm asking from ignorance.
I'd like to know something about Ruby before I invest time in it.  As
you say, Haskell is attractive because it's very different.  Ruby is
only interesting to me if (a) I need to hack an existing Ruby
application (I don't yet) or (b) Ruby has genuine advantages over
Python.  You claim that (b) is the case:

To be honest, I do not program in Python and I have only looked at it from a cursory glance. I have modified some Python source code in Trac to remove its' demand that every svn commiter has an associated email address. That was not too hard to do.

 > so I will end it with this.  I think Ruby and Python have a number
 > of similar attributes, but that Ruby has a significantly stronger
 > OO model and other

But where is it "stronger"?  What is it that Ruby's model makes
possible, or at least significantly easier and less fragile than in
Python's?

It is hard to describe, but in Ruby everything is an Object. This has a profound impact on development and is something that you just have to try to fully understand. Be warned, it does make going back to a language that claims to be OO but does not follow this model very hard.

 > techniques like blocks and lambdas that make it a bit strong than
 > Python.

Python *has* lambdas; it just doesn't have anonymous ones (I don't
consider the toy "one-line lambda" a real lambda).  Python's functions
are first class objects; they can be assigned and queried, you can use
them to build closures, and you can define local functions (as
contrasted with methods).  Again, this seems to be a minor case of
syntactic sugar to me.

Blocks are another matter.  I don't really understand blocks; what are
they good for?

Blocks are what got me excited about Ruby at first. They are basically anonymous closures. In Ruby they are used heavily in the API and make for a more pleasant experience. I would like to write more about these things, but so much has been said on the web that I will just provide a number of links.

Blocks:

* http://martinfowler.com/bliki/CollectionClosureMethod.html

* http://www.martinfowler.com/bliki/Closure.html

Ruby and Python comparisons (Most appear a bit outdated, but still relevant)

* http://www.rubycentral.com/faq/rubyfaq-2.html

* http://www.rexx.com/~oinkoink/Ruby_v_Python.html

* http://blog.ianbicking.org/ruby-python-power.html

* http://onestepback.org/index.cgi/Tech/Ruby/PythonAndRuby.rdoc


Simple intro to Ruby for Java programmers:

* http://onestepback.org/articles/10things/index.html

Cheers,
Zev


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links