Securing a future for anonymous functions in Python

Jeff Shannon jeff at ccvcorp.com
Wed Jan 12 18:24:18 EST 2005


Jacek Generowicz wrote:

> One more question. Imagine that Python had something akin to Smalltalk
> code blocks. Would something like
> 
>     map([x | x+1], seq)
> 
> be any better for you than
> 
>     map(lambda x:x+1, seq)
> 
> ?

I'd say that this is very slightly better, but it's much closer (in my 
mind) to map/lambda than it is to a list comprehension.  In this case, 
at least the code block is visually self-contained in a way that 
lambdas are not, but I still have to do more mental work to visualize 
the overall results than I need with list comps.

Jeff Shannon
Technician/Programmer
Credit International




More information about the Python-list mailing list