Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #9889

Re: Partial Function Application -- Advantages over normal function?

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'bind': 0.09; 'subject:Function': 0.09; 'am,': 0.13; 'wrote:': 0.15; '12:22': 0.16; 'def.': 0.16; 'lambda': 0.16; 'simplified': 0.16; 'subject:function': 0.16; 'anonymous': 0.16; 'cc:addr:python- list': 0.16; 'def': 0.16; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'tue,': 0.23; 'subject: -- ': 0.25; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.30; 'construct': 0.30; 'subject:?': 0.31; 'functions.': 0.37; 'received:google.com': 0.38; 'received:209.85.161': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'received:209': 0.40; 'making': 0.66; 'subject:over': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=DfvpiuxXY/dfaed64B7vUnu12CaSL64UrSxcyx8Zrts=; b=CJu0QTnhVNrOWYCdBbwNWjQXVbO9N0rIHtYyMT9zaWAh5ezAzRQhZMoYx7RHBFMMbq sufuUV+x1QdL2vbgDgYQX0af7Kb+n+B4jzbMkdSv44dXlVYsW6+103FhrP8A5K2iifiC dyvpWPNuWfGiIw9YcZLXUkm3Lhvo8giHQMJI4=
MIME-Version 1.0
In-Reply-To <4E25228C.6000705@jollybox.de>
References <201107181543.42229.kurianmthayil@gmail.com> <CACNEfZaLVqY=HFvRGYbKMFxLtYBU0gLDmFfMguorJznDGOh=yA@mail.gmail.com> <j0239q$smp$1@dough.gmane.org> <mailman.1232.1311025576.1164.python-list@python.org> <1405042.q1RDiLHYyK@PointedEars.de> <4247181.bSrEuok8ZT@PointedEars.de> <4E25228C.6000705@jollybox.de>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 19 Jul 2011 10:49:00 -0600
Subject Re: Partial Function Application -- Advantages over normal function?
To Thomas Jollans <t@jollybox.de>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1258.1311094174.1164.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1311094174 news.xs4all.nl 23957 [2001:888:2000:d::a6]:55220
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:9889

Show key headers only | View raw


On Tue, Jul 19, 2011 at 12:22 AM, Thomas Jollans <t@jollybox.de> wrote:
>> Supplemental: The above can be simplified to
>>
>> def makeadder(y): return lambda x: x + y
>>
>
> In turn:
>
> makeadder = lambda y: lambda x: x + y

That's not an improvement.  lambda is for making anonymous functions.
If you're going to construct a lambda and bind it to a name, you
should just use def.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Partial Function Application -- Advantages over normal function? Dave Angel <davea@ieee.org> - 2011-07-18 17:45 -0400
  Re: Partial Function Application -- Advantages over normal function? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-19 00:28 +0200
    Re: Partial Function Application -- Advantages over normal function? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-19 00:33 +0200
      Re: Partial Function Application -- Advantages over normal function? Thomas Jollans <t@jollybox.de> - 2011-07-19 08:22 +0200
      Re: Partial Function Application -- Advantages over normal function? Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-19 10:49 -0600
      Re: Partial Function Application -- Advantages over normal function? Thomas Jollans <t@jollybox.de> - 2011-07-19 18:58 +0200
      Re: Partial Function Application -- Advantages over normal function? Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-19 11:15 -0600
    Re: Re: Partial Function Application -- Advantages over normal function? Dave Angel <davea@ieee.org> - 2011-07-19 06:07 -0400
    Re: Partial Function Application -- Advantages over normal function? Terry Reedy <tjreedy@udel.edu> - 2011-07-19 12:47 -0400

csiph-web