lambda ??

Michael Foord fuzzyman at gmail.com
Fri Aug 27 04:00:34 EDT 2004


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