"Danny Yoo" <[EMAIL PROTECTED]> wrote > So let's try to squash this one now. There are more interesting > problems > to solve. Or other flame wars to fight.
I wasn't aware we were having a war, but I'm happy to desist :-) > Let me see if we can do something constructive. I've been doing a > shallow, superficial study of the Ruby language at the moment. One > of the > things I've been impressed about is that they've managed to make > lambdas > look non-threatening to people with their syntactic sugar of "code > blocks". Ruby blocks are almost as good as Smalltalk blocks for this kind of thing and very powerful. Regular readers will know I have often expressed dissappointment at the limitations of Python's lambdas, it's one thing the Ruby boys have got right IMHO. > The exact functionality can be done in Python, but it does look a > little > more intimidating at first: > > ## Python > def twice(f): > f() > f() > twice(lambda: sys.stdout.write("hello world\n")) > > This does the same thing, but it looks a little scarier because the > concepts needed to grasp his are superficially harder than that in > the > Ruby code. The other advantage in Ruby is that the block can be arbitrarily complex, not just a single expression as in a Python lambda. This allows us to embed loops and all sorts, effectively adding new command structures to the language in a way that only Lisp and Tcl have really been good at up till now. Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor