Of what use is 'lambda'???

Guido van Rossum guido at beopen.com
Thu Sep 21 09:40:11 EDT 2000


(Just happened upon this discussion...)

There's a difference between the need for lambda in Python and in most
other languages -- certainly elisp.

In elisp (AFAIK), when you define a function, the name you give it is
globally registered, so you need to make sure it doesn't conflict with
other functions.  Anonymous functions defined with lambda avoid this.

But in Python, when you define a function locally (inside another
function), its name is a local variable!  Thus, the burden of coming
up with a good name for it is no worse than for other local variables
-- so you may call it 'f' if you want to.

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)



More information about the Python-list mailing list