using lambda to print everything in a list
Alex Martelli
aleaxit at yahoo.com
Fri Apr 27 04:11:55 EDT 2001
"Bjorn Pettersen" <BPettersen at NAREX.com> wrote in message
news:mailman.988332640.18020.python-list at python.org...
[snip]
> def write(x):
> print x
>
> map(lambda x: write(x), ['line one', 'line two'])
As is becoming pretty usual with me, I don't see the
"added value" of the lambda. Wouldn't:
map(write, ['line one', 'line two'])
be definitely preferable?
> however,
>
> for x in ['line one', 'line two']:
> print x
>
> is much clearer IMHO.
Nolo contendere on this! Looks even clearer to me, too.
Alex
More information about the Python-list
mailing list