From: Chad Perrin Date: 2007-10-02T04:58:10+09:00 Subject: Re: Can you please help to make decision? On Mon, Oct 01, 2007 at 03:25:37AM +0900, 7stud -- wrote: > Here's a simple test for the op. Which of the following do you think is > easier to understand? Can you guess what each program does? > > language1: > -------- > > colors = ["red", "blue", "green"] > > colors.each {|color| puts color} > > > language2: > --------- > colors = ["red", "green", "blue"] > > for color in colors: > print color In the case of someone who has never programmed before, I rather think "colors.each {|color| puts color}" might be less confusing than "for color in colors:\n print color". I have never in my life seen anything in plain English that even began to look like "for color in colors", and the meaning of that clause is non-obvious. Meanwhile, "colors.each" at least looks like it's saying something about each of something, with the "each" attached obviously to the "colors", suggesting that it's saying "for each element of the colors array". The only way the Python one looks anything like "more intuitive" to someone who has never encountered Ruby or Python before, as far as I can tell, is if that person is familiar with C. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] They always say that when life gives you lemons you should make lemonade. I always wonder -- isn't the lemonade going to suck if life doesn't give you any sugar?