Securing a future for anonymous functions in Python

Jacek Generowicz jacek.generowicz at cern.ch
Wed Jan 12 03:23:47 EST 2005


Jeff Shannon <jeff at ccvcorp.com> writes:

> I guess we'll have to agree to disagree

Indeed :-)

> I find that reading a lambda requires mentally pushing a stack frame
> to parse the lambda and another to translate map() into a loop,
> whereas a list comp's expression doesn't require such a shift

>  From the sounds of it, you may have the opposite experience with
>  reading map/lambda vs. reading list comps

No, I'm perefectly happy with both. I'm just trying to understand the
underlying reasons for people having trouble with one or the other, in
order to be better armed when the didactic need might arise.

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)

?



More information about the Python-list mailing list