Draft Pep (was: Re: Let's Talk About Lambda Functions!)
fakeaddress at nowhere.org
Mon Aug 5 09:50:10 CEST 2002
François Pinard wrote:
> The rumour states that Guido regrets having added `lambda' to Python.
> I guess it goes beyond the mere `lambda' keyword: it is reasonable to
> think that what Guido regrets is the addition of anonymous functions.
Contrary to popular belief, lambda did not add anoymous functions to
Python. Python had them even without lambda.
return x + x
The above code passes 17 to a function which is not bound to any name.
> If the rationale is essentially reduced to the vague statement of a
> "continuous interest", it is a pretty weak rationale. Before anything
> else, the rationale should stress, in very convincing ways, why anonymous
> functions should grow stronger in Python, instead of being faded out.
I tried to do that in a previous response. Python should have a
procedure builder which does not assign the procedure to a name, because
procedure in Python are first-class values and do not have intrinsic
The current rules mislead people, away from an understanding of first-
class procedures. The variables to which a procedure is assigned has
nothing to do with the value that is the procedure. The name of a
variable is not a property of a procedure value, nor is "anonymous". Is
(4, "hello") an anonymous tuple, or 7 + 2 an anonymous integer?
Lack of a full lambda prevents Python from being a really good teaching
language. Use of def hides the true semantics of procedures. Just
reading this thread one can see insinuations of an absurd notion that
def is simpler than lambda.
> Also, recent additions in Python are said to significantly alleviate most
> of the need for anonymous functions, so the rationale of this PEP might
> explain why these additions are still not satisfactory on that respect.
A full lambda would alleviate the need for the more complex def.
More information about the Python-list