From: Adam Spitz Date: 2003-03-27T15:51:44+09:00 Subject: Re: What are the differences between Ruby's blocks and Python's lambdas? Greg Ewing wrote: > sdieselil wrote: > >> What are the differences between Ruby's blocks and Python's lambdas? > > > The main one is that a Python lambda can only contain > an expression, whereas a Ruby block can contain arbitrary > statements. This discussion is scaring me. There's a big, huge, fundamental difference between Smalltalk/Ruby's blocks and Lisp/Python's lambdas: blocks don't make me spew the word "lambda" all over my code. A Ruby block might have similar mathematical properties to a Python lambda, but psychologically they're completely different. A block is much more lightweight. That's why Ruby programmers use blocks all over the place without any qualms at all, whereas Python programmers decided that they wanted list comprehensions and those fancy generator things. (I understand that it's a bit more complex than that, and that list comprehensions and generators have a couple of interesting good properties. It just irks me to hear people say that blocks and lambdas are almost the same except for these little technical differences; they really start to look very very different, as soon as you admit to yourself that this psychological stuff matters.) Adam Spitz