From: Martin DeMello Date: 2008-05-08T09:49:09+09:00 Subject: Re: "Real" Differences Between Python & Ruby On Wed, May 7, 2008 at 5:23 PM, Max Cantor wrote: > I have a question about the difference(s) between Python and Ruby. I > have been working with both languages for about one year each now, and I > keep finding differences that turn out to be just syntactical. I will > elaborate, but this is the gist of my question: > > What can Python do that Ruby can't? What can Ruby do that Python can't? > What does Ruby gain from its syntactic quirks, other than easier DSL > implementation? One often-overlooked point is the design of the standard library. For example, one of ruby's major design decisions is the syntactically convenient and addition of one free closure to every method, with a lightweight, performant way to invoke it. That led to things like a collection interface built around the concept of internal iterators, the pervasive use of the open resource/ yield to caller/ close resource pattern, and an avoidance of higher-order-functions and patterns that would have required *two* lambdas passed in. Python both makes inline anonymous closures highly inconvenient, and provides cheap generators (something hard to do in ruby without a large performance hit), leading to the more pervasive use of external iterators. Also, rubyists like method chaining, and pythonists don't, which is why several methods in the python stdlib return None if they are being called for their side effects, where a ruby method would tend to return self. martin