[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Need examples comparing Ruby to Python
From:       gabriele renzi <surrender_it () rc1 ! vip ! ukl ! yahoo ! com>
Date:       2004-02-23 20:04:48
Message-ID: 91mk30hgvo4sdjbokc5sg6ac0tbk6sj3el () 4ax ! com
[Download RAW message or body]

il Mon, 23 Feb 2004 12:14:33 -0700, David MacQuigg <dmq@gain.com> ha
scritto::


>
>>but maybe, you should undeline that ruby has had oo+iterators since
>>the beginning, while python added them later. This reflects in the
>>'feeling' of the language, I believe
>
>I'm trying to avoid differences that are no longer true, and stay
>neutral with regard to matters of personal preference, like the "feel"
>of the language.  This should get us down to just a few examples where
>Ruby has an advantage.

I don't think that is a personal preference :)
I mean, in python you'll often see free function like 
len(obj) or dir(), while in ruby you'd do obj.length and obj.methods.

That reflect on other things like hash keys. There are no special type
in ruby, so you can use everything as an hash key.


Another example that suddenly appeared to me: slightly different
lexical closures:
 def make_accumulator (n)
  lambda {|i| n += i }
 end

That is little harder in python cause you don't have access to the
variable 'n' , just his object. 



BTW, as I said, little differences.
 





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic