From: sera@... (Francis Hwang) Date: 2004-01-22T05:34:59+09:00 Subject: Re: New to Python: my impression v. Perl/Ruby Ville Vainio wrote in message news:... > Phil> 10.times do something end > > Phil> is somehow so clear. It's almost zenlike. > > It's cute and fun to write, but less cute for people who have to read > lots of such code in short time. I have a soft spot for such style > also; I kinda like Python's "\n".join(["foo","bar"]), even if most > seem to consider it a wart for readability reasons. A lot of this has to do with how you conceptualize objects. In some languages objects are big and heavyweight. So the few things that get to be called Objects are blessed with special powers, and the lowly primitive values are supposed to look up to them with admiration and reverence. In other languages everything can be an object, which means that you have to think of the "object" idea differently. In Ruby integers are objects, but there's a lot of syntactic sugar to make that happen. After all, 10.times do something end is basically just fancy talk for for (i = 0; i < 10; i++ ) { something } or whatever you think should be more explicit. This method might break your conceptual model of what an object is, depending on which model you like. Personally, I love the Fixnum#times method, since it means I never make fence-post errors anymore. More time for interesting problems, less time spent on tediously stepping through code one iteration at a time. And if my conceptual model is getting in the way of my ability to write error-free code, then it's the conceptual model that has to change. Besides, once a language is Turing-complete, everything else is syntactic sugar. So you might as well get the best syntactic sugar you can get ... Francis