Partial Function Application -- Advantages over normal function?

Kurian Thayil kurianmthayil at gmail.com
Tue Jul 19 10:25:10 CEST 2011


On Tue, Jul 19, 2011 at 11:52 AM, Thomas Jollans <t at jollybox.de> wrote:

> On 19/07/11 00:33, Thomas 'PointedEars' Lahn wrote:
> > Thomas 'PointedEars' Lahn wrote:
> >
> >> Dave Angel wrote:
> >>> On 01/-10/-28163 02:59 PM, Terry Reedy wrote:
> >>>> def makeadder(y)
> >>>>     def _add(x): return x+y
> >>>> add2 = makeadder(2)
> >>>
> >>> A couple of typos in that code:
> >>>
> >>> def makeaddr(y):
> >>>      def _add(x): return x+y
> >>>      return _add
> >>
> >> I agree about the `return' statement, but not about the factory name;
> this
> >> has nothing to do with addresses (addr).
> >
> > Supplemental: The above can be simplified to
> >
> > def makeadder(y): return lambda x: x + y
> >
>
> In turn:
>
> makeadder = lambda y: lambda x: x + y
>
> Smells of Haskell.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Hi All,

Thanks guys for the reply. I now understand something. Since Im a newbie,
let me read over and over so that I will get the complete picture of
everyone's idea. :-)

Regards,
Kurian Thayil.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110719/3688e563/attachment.html>


More information about the Python-list mailing list