Sybren Stuvel <[EMAIL PROTECTED]> writes:
> > No, it is not merely a shortcut.  It often allows one to avoid
> > polluting the namespace with a completely superfluous function name,
> > thus reducing code smell.
> 
> Which can also be done by using inner functions.

Inner functions with no names?

> > It can also avoid a multi-line function defintion which often pushes
> > other relevant code off the current page and out of view, and thus
> > lambda can increase program readability.
> def somefunc(x): return x*5
> How is that a multi-line function definition?

    def mult_by_five():
       def somefunc(x): return x*5
       return somefunc

is multi-line, as opposed to:

    def mult_by_five(): return lambda x: x*5
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to