Why functional Python matters
David Eppstein
eppstein at ics.uci.edu
Tue Apr 15 21:23:47 EDT 2003
On Tue, Apr 15, 2003 at 11:04:06PM -0000, Dave Benjamin wrote:
> > I think that list comprehensions bridge the gap somewhat between FP and OO
> > methods, and this is one thing I really like them for. For instance:
> >
> > [obj.method(x) for x in data]
> >
> > looks nicer to me than:
> >
> > map(lambda x: obj.method(x), data)
Sure, but wouldn't it be even better to use
map(obj.method, data)
?
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list