List comprehension confusion...

Christopher A. Craig list-python at ccraig.org
Mon Feb 3 10:08:43 EST 2003


Lulu of the Lotus-Eaters <mertz at gnosis.cx> writes:

> I actually kinda agree.  Most people dread lambdas because of what they
> are (the semantics).  Myself, I only have trouble with their
> spelling.

They're much better now than they used to be (before statically nested
scopes went in).

I can remember writing things like

reduce(lambda a, x=x, y=y: a+x+y, list)

in order to get around the fact that scopes didn't nest.  That said I
usually still prefer listcomps to lambdas for readability.

-- 
Christopher A. Craig <list-python at ccraig.org>
"I wouldn't be surprised if the architecture of Intel's microprocessors
were eventually linked to the eventual fall of mankind." Steve Gibson





More information about the Python-list mailing list