[docs] Lambda Forms error

Sandro Tosi sandro.tosi at gmail.com
Sun May 13 18:24:28 CEST 2012

Hello Cosmin,
thanks for your email.

On Thu, Apr 26, 2012 at 8:58 AM, Cosmin Parvulescu
<cosmin.parvulescu at gmail.com> wrote:
> Greetings,
> While skimming through the tutorial I came across this line "Here’s a
> function that returns the sum of its two arguments: lambda a, b: a+b"
> followed by this example
>> def make_incrementor(n):
>>     return lambda x: x + n
> I believe it is a mistake and the example should be changed to something
> along the lines of
> f = lambda a, b:a + b

Mh I don't think so: the first in-line example wants just to show how
the lambda syntax. In fact.

>>> f = lambda a, b: a + b
>>> f(3, 4)

While the second example wants to show that you can define a
"half-defined" function (make_incrementor) which then you can
instantiate and call.

Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

More information about the docs mailing list