From: GGarramuno@... (GGarramuno) Date: 2004-01-21T16:59:59+09:00 Subject: Re: New to Python: my impression v. Perl/Ruby "Zach Dennis" wrote in message news:... > Ville>Though "sending messages" to int literals is a syntax error. > > >Phil> 10.times do something end > > >Phil> is somehow so clear. It's almost zenlike. > > Ville>It's cute and fun to write, but less cute for people who have to read > Ville>lots of such code in short time. > > Ville, > > 10.times do something end > > How is the the above code less 'cute' for people who have to read lots of > code? Well, that isn't too confusing. But one issue with looping using the object.method() constructs is when you are dealing with variables. That is: 10.times do something end is extremely nice and very clear to read. However: i = 10 # somewhere out there # and then somewhere else... i.times do something end is confusing as you have no clue what class i is and as such, no idea what times may be doing. In those cases, a for or while loop is preferable and should be enforced, in my opinion. In my experience, it is much more common for algorithms to be looping involving arbitrary numbers stored in variables than predetermined times, so I also tend to agree that such constructs are cute but not something I'd likely use often in real code.