You can edit the book online. Just register, than let me know when
done and I will make you editor.

On Sep 19, 3:32 pm, cjrh <[email protected]> wrote:
> Could I take a crack at editing it?   I won't change the book online
> directly, I'll mail you the modified markup text directly, to check
> with you.
>
> Ok?
>
> On Sep 19, 10:09 pm, mdipierro <[email protected]> wrote:
>
> > You are right.
>
> > On Sep 19, 2:14 pm, cjrh <[email protected]> wrote:
>
> > > Hi
>
> > > With my editor cap on, I am working my way through the documentation.
> > > The section on lambda, in the python language section of the book,
> > > makes me uncomfortable.  It says this:
>
> > > ***
> > > The existence of lambda allows re-factoring an existing function in
> > > terms of a different set of arguments. cache.ram and cache.disk are
> > > web2py caching functions.
> > > ***
>
> > > It is implied that the lambda keyword allows currying, when in fact
> > > that functionality is provided by standard Python functions.  For
> > > example (using the example given in the text),
>
> > > >>> def f(a, b): return a + b
> > > >>> g = lambda a: f(a, 3)
> > > >>> g(2)
>
> > > 5
>
> > > Could be written without lambda as
>
> > > >>> def f(a,b): return a + b
> > > >>> def g(a): return f(a, 3)
> > > >>> g(2)
>
> > > 5
>
> > > The anonymity of lambda means that inline code is allowed, because no
> > > prior declaration is needed in order to obtain a reference, as is the
> > > case with def, but on the other hand, lambdas are limited to a single
> > > expression, whereas def functions are not.  Consider the next example:
>
> > > >>> number = 7
> > > >>> print cache.ram(str(number), lambda: isprime(number), seconds)
> > > True
> > > >>> print cache.ram(str(number), lambda: isprime(number), seconds)
>
> > > True
>
> > > Could be rewritten as
>
> > > >>> number = 7
> > > >>> def isprimecall: return isprime(number)
> > > >>> print cache.ram(str(number), isprimecall, seconds)
> > > True
> > > >>> print cache.ram(str(number), isprimecall, seconds)
>
> > > True
>
> > > In conclusion, the description of lambda in the text is misleading.
> > > Comments?
>
>

Reply via email to