From: Avdi Grimm Date: 2008-05-08T09:58:50+09:00 Subject: Re: "Real" Differences Between Python & Ruby On Wed, May 7, 2008 at 8:23 PM, Max Cantor wrote: > 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? > > So, how do blocks in Ruby REALLY differ from lambdas in Python? Is > there anything you can do in one language that some fancy footwork can't > achieve in the other, or is that the point of their differences? I know > all of the knee-jerk reactions: Multiple inheritance, syntactical > indentation, keyword arguments, regex literals... those are all either > matters of taste or easily simulated. What are the "real" differences, > if any? Was Matz's intention in creating Ruby to approach existing > functionality with a new syntax, or are there things I'm not seeing? First of all, you seem to be coming at it from the assumption that Ruby is a response to Python, or vice-versa. Both Ruby and Python are far more influenced by their shared ancestors - Lisp, Smalltalk, Perl, Modula, C, to name just a few - than they are by each other. BOTH languages are "nothing new" in the sense that Lisp, Smalltalk, Perl et al already had full fledged closure semantics when Ruby and Python arrived on the scene. So yes, in that sense it's just a matter of syntax. If you are interested in a closure-related feature that DOES differentiate the two languages, look at continuations (Kernel#callcc). Python, with the possible exception of the Guido-disowned Stackless variant, does not support continuations. Of course, with JRuby not supporting continuations and MRI 1.9 apparently moving to Fibers, this may cease to be a point of differentiation in the future. A prospect that I personally find disappointing. -- Avdi Home: http://avdi.org Developer Blog: http://avdi.org/devblog/ Twitter: http://twitter.com/avdi Journal: http://avdi.livejournal.com