lambda ??

Jan Gregor gregor.jan at NOSPAMquick.cz
Fri Aug 27 05:09:59 EDT 2004


Python is little bit limited in lambda functions. In lisp I use lambda
functions in functionals (something like a map or reduce in python)
as a wrapper for functions with more than one argument.

Jan

On 2004-08-27, Michael Foord <fuzzyman at gmail.com> wrote:
> I'm starting to read through the developer works article on Functional
> Programming - http://www-106.ibm.com/developerworks/library/l-prog.html
>
> It starts by giving some basic examples using lambda. What I'm
> wondering is what's the actual difference between these two forms ?
>
> pr = lambda s:s
> *and*
> def pr(s):
>     return s
>
> Both bind the name 'pr' to a function object that does the same thing
> ?? I know that lambda functions can only be a single expression......
>
> Is it just a basic example (and so in this case there is no
> difference).. or am I missing something. (What's the point of an
> 'anonymous' function... if you give a name to it !!).
>
> Regards,
>
> Fuzzy
>
> http://www.voidspace.org.uk/atlatnibots/pythonutils.html



More information about the Python-list mailing list