Draft Pep (was: Re: Let's Talk About Lambda Functions!)
johnroth at ameritech.net
Mon Aug 5 07:54:01 EDT 2002
"Bryan Olson" <fakeaddress at nowhere.org> wrote in message
news:3D4E2E87.9070308 at nowhere.org...
> François Pinard wrote:
> > The rumour states that Guido regrets having added `lambda' to
> > I guess it goes beyond the mere `lambda' keyword: it is reasonable
> > think that what Guido regrets is the addition of anonymous
> Contrary to popular belief, lambda did not add anoymous functions to
> Python. Python had them even without lambda.
> def define_twice():
> def _twice(x):
> return x + x
> return _twice
> print define_twice()(17)
> The above code passes 17 to a function which is not bound to any name.
It is bound to a name. Specifically, it's bound to _twice. The
fact that the name is part of the function's scope, and not the
enclosing class or module scope doesn't make it not a name!
> > If the rationale is essentially reduced to the vague statement of a
> > "continuous interest", it is a pretty weak rationale. Before
> > else, the rationale should stress, in very convincing ways, why
> > functions should grow stronger in Python, instead of being faded
> I tried to do that in a previous response. Python should have a
> procedure builder which does not assign the procedure to a name,
> 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".
> (4, "hello") an anonymous tuple, or 7 + 2 an anonymous integer?
> Lack of a full lambda prevents Python from being a really good
> 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
> > of the need for anonymous functions, so the rationale of this PEP
> > explain why these additions are still not satisfactory on that
> A full lambda would alleviate the need for the more complex def.
I don't see how 'def' is more complex than a 'full lambda.' Possibly
you could elucidate?
More information about the Python-list