Re: "Real" Differences Between Python & Ruby
by Martin DeMello other posts by this author
May 7 2008 5:49PM messages near this date
Re: "Real" Differences Between Python & Ruby
|
Ruby Gems ERROR: could not find rush locally or in a repository
On Wed, May 7, 2008 at 5:23 PM, Max Cantor <maxcantor@[...].com> 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
Thread:
Max Cantor
Avdi Grimm
Globalrev
Marc Heiler
Max Cantor
Michael T. Richter
M. Edward Borasky
Michael T. Richter
M. Edward Borasky
Eleanor McHugh
Michael T. Richter
Steven Parkes
Avdi Grimm
Max Cantor
Adam Shelly
Robert Dober
David A. Black
Robert Dober
Phillip Gawlowski
Martin DeMello
|