Alexandru Popescu wrote:

> #: Jamey Cribbs changed the world a bit at a time by saying on  
> 8/19/2005 3:18 AM :#
>
>>
>> Now, you can still do closures in Python by actually passing a named 
>> function, but using blocks is just so much more elegant.
>>
>
> What about lambdas? (afaik python has lambdas and a notion called maps 
> - but about the 2nd I am not pretty sure).

I think I mentioned Python's lambda a paragraph or two above the one you 
quoted (I don't have my original post in front of me so I can't say for 
sure).  You can definitely do closures with Python's lambda, but it is 
not as powerful as Ruby's block because a Python lambda can only have 
one statement in it and it cannot be an assignment.  You might think 
that this is not that important.  Well, being able to do assignment(s) 
in a block allows me to program KirbyBase to handle this:

plane_tbl.update { |r| r.name == 'P-51' }.set do |r|
    r.speed = 405
    r.range = 1210
end

This says, for the record where name equals P-51, change the speed to 
405mph and the range to 1,210 miles.  I couldn't do this with a lambda 
in Python.

Jamey