[Baypiggies] lambda for newbies

Collin Winter collinw at gmail.com
Fri May 11 21:14:07 CEST 2007


On 5/11/07, David Berthelot <d_berthelot at yahoo.com> wrote:
> Ok thanks for the links (I bookmarked your functional package, because I'm also a heavy user of partial function application, why right now I do by doing something along the line of fz5 = lambda x,y:f(x,y,z=5))
>
> So basically Guido really wants to bin lambda,map,reduce,filter which are constructs I use a lot.
>
> I can understand for map,filter given the redundant semantic. I can accept that reduce is easier to read written as a loop, although I find it useful for combining one-to-one elements in lists (and lists of lists, etc...).
>
> Now for lambda, basically it's still very useful even without filter,reduce or map. That's probably the most controversial one to me.
>
> I often use it to pass basic functions (that are so basic that keeping them unnamed is perfect) to other functions. If I have to name all those unnamed lambda functions to use them, that's going to be quite verbose, probably a bit too much.

Sorry, I forgot to mention that that article is somewhat out-of-date.
Only the section on reduce() is still really relevant: lambda, map and
filter are all going to stay in the language. PEPs 3099 and 3100
provide a good summary of what will and won't change in Python 3.

Collin Winter


> ----- Original Message ----
> From: Collin Winter <collinw at gmail.com>
> To: David Berthelot <d_berthelot at yahoo.com>
> Cc: Dan Weeks <dan+baypiggies at danimal.org>; Python <baypiggies at python.org>
> Sent: Friday, May 11, 2007 11:18:16 AM
> Subject: Re: [Baypiggies] lambda for newbies
>
> On 5/11/07, David Berthelot <d_berthelot at yahoo.com> wrote:
> > Ok, it's my first post on the list, hi everyone.
> >
> > That being said, what is the reason for removal of reduce() ?
> > I love this function, how is its functionality going to be done next ?
>
> Guido's position: http://www.artima.com/weblogs/viewpost.jsp?thread=98196
>
> My own functional package
> (http://cheeseshop.python.org/pypi/functional/) provides reduce() and
> other functional programming constructs; it will continue to be
> available for Python 3.
>
> Collin Winter
>
>
> > ----- Original Message ----
> > From: Collin Winter <collinw at gmail.com>
> > To: Dan Weeks <dan+baypiggies at danimal.org>
> > Cc: Python <baypiggies at python.org>
> > Sent: Friday, May 11, 2007 8:06:49 AM
> > Subject: Re: [Baypiggies] lambda for newbies
> >
> > On 5/11/07, Dan Weeks <dan+baypiggies at danimal.org> wrote:
> > > On 2007-05-11 01:03, Shannon -jj Behrens threw down some bits like this:
> > > > Hey guys,
> > > >
> > > > I often hear Python newbies who are confused about lambda.  Let's
> > > > start with some code:
> > >
> > > > These days, with list comprehensions, you can just write:
> > >
> > > While it's great that to teach about lambda and lisp-like programming
> > > I think focusing on list comprehensions is well more worth while,
> > > especially since they're more pythonic and the lisp-like lambda,
> > > filter(), map(), and reduce() are slated for removal in Python 3000.
> > > Of course there is code that exists that needs to be maintained now and
> > > you've done a good job of explaining lambda for newbies so they can do
> > > that.
> >
> > map() and filter() will stay; only reduce() is being removed.
> >
> > Collin Winter
> > _______________________________________________
> > Baypiggies mailing list
> > Baypiggies at python.org
> > To change your subscription options or unsubscribe:
> > http://mail.python.org/mailman/listinfo/baypiggies
> >
> >
> >
> >
> >
> >
> > ____________________________________________________________________________________Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
> > http://answers.yahoo.com/dir/?link=list&sid=396545469
> >
>
>
>
>
>
>
> ____________________________________________________________________________________Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
> http://mobile.yahoo.com/go?refer=1GNXIC
>


More information about the Baypiggies mailing list