Fate of lambda, Functional Programming in Python...

Peter Kleiweg in.aqua.scribis at nl.invalid
Fri Aug 20 17:23:32 EDT 2004


Anthony Baxter schreef:

> On Fri, 20 Aug 2004 12:50:02 -0400, Chas Emerick <cemerick at snowtide.com> wrote:
> > In a comment off a post on lambda-the-ultimate, I noticed this little
> > offhand remark:
> >
> > '''IIRC GvR is going to kill the various lambda, map,filter & reduce
> > leaving just generator expressions/list comprehension.'''
>
> First point: lambda, map, filter and reduce won't go away before Python 3.0,
> at the very least. And, to be honest, I suspect map/filter/reduce are much more
> likely to die than lambda, as they can nearly always be expressed more clearly
> as listcomps or genexprs.

The Python Cookbook, recipe 1.8, "Finding the Intersection of
Two Dictionaries" shows different methods of doing this
particular thing, among them list comprehension and filter.
Here, using filter is the fastest of all.

Why would you want to do away with something that is useful?

> Having said that, and donning my interpreting-Guido-hat, the major problem
> with lambda is the scoping issue. Nested scopes make this less of a problem.
> In addition, the name 'lambda' was a poor poor choice.

The choice is perfectly logical.

-- 
Peter Kleiweg  L:NL,af,da,de,en,ia,nds,no,sv,(fr,it)  S:NL,de,en,(da,ia)
info: http://www.let.rug.nl/~kleiweg/ls.html

The Halloween Documents: http://www.opensource.org/halloween/




More information about the Python-list mailing list