[Tutor] Ruby Code Blocks vs. Python Lambdas

Andreas Kostyrka andreas at kostyrka.org
Tue Nov 7 12:20:16 CET 2006

Am Dienstag, den 07.11.2006, 09:56 +0000 schrieb Alan Gauld:
> "Carroll, Barry" <Barry.Carroll at psc.com> wrote
> > Thank you for this post.  I was in a discussion of Ruby vs. Python 
> > at
> > lunch today.  The consensus was that Python was much better than 
> > Ruby in
> > all ways.

That's bullshit. Python and Ruby are quite comparable.

They differ only on stuff like:

a) Syntax (I prefer the clean intended Python syntax, and Ruby claim to
be Perlish is a major turnoff)
b) Runtime/Library (When I learned Ruby sometime ago, the library
support was bad)

c) Python has a more general set of ideas, while Ruby is clearly
patterned on Smalltalk, at least to me.

One major cool thing that Ruby (and Smalltalk) has, are codeblocks. I've
been thinking on and off for years how to add these to Python, but I
have not really come up with a compact syntax that would transport the
same functionality nicely.

So no, Python is no way superior to Ruby in all ways. Nor is Ruby
superior in all ways to Python. The point is, they live both in
comparable ecological niches, and you can probably do everything you can
do with Python in Ruby and the other way.

As a decade long Python coder, I've taken a look at Ruby, found it quite
ok, but I stay for my own stuff with Python, because:

a) Did I mention the decade doing Python stuff, starting with Python

b) Ruby allows a number of interesting things easily, e.g. classes are
never closed, and so on. OTOH, while it is not always as pretty, I can
get 99% of that stuff hacked in Python too, and I'm not completely sure
if I like some of these ideas, design-wise anyway. ;)

c) I don't like the syntax that much, especial the referal to Perl.

d) At the time I did evaluate Ruby, the Ruby library was poor compared
to the Python offering.


> That's a little hard on Ruby. There are many good features and several
> of them are arguably improvements on Python. But Python is
> still easier for me personally to grok, I'm not sure why exactly.
> > I have struggled considerably with lambdas since taking up Python. 
> > I'm
> > still not really comfortable using them in production code.  I agree
> > that Ruby's style is more intuative and easier to use.  I wonder if 
> > a
> > future version of Python could adopt this style.
> I think it would be difficult without adding block delimiters to
> the language, and most of the common symbols already
> have a role ([],(),{}, |, etc).
> Also Guido prefers explicit definition of functions to
> anonymous ones - explicit is better than implicit is
> one of Pythons principles after all.
> Alan G. 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.python.org/pipermail/tutor/attachments/20061107/61f5920f/attachment.pgp 

More information about the Tutor mailing list