functional programming with map()
David Eppstein
eppstein at ics.uci.edu
Sun Feb 24 22:34:34 EST 2002
In article <a5cb54$27c2$1 at agate.berkeley.edu>,
Daniel Yoo <dyoo at hkn.eecs.berkeley.edu> wrote:
> : But what is the functional equvalent of:
>
> : for x in items:
> : x.f()
>
>
>
> Here's one way to do it:
>
> ###
> map(lambda x: x.f(), items)
> ###
I'd prefer
[x.f() for x in items]
It's not functional syntax, but so what?
--
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list
mailing list