Python syntax in Lisp and Scheme
David Eppstein
eppstein at ics.uci.edu
Tue Oct 14 20:17:38 EDT 2003
In article <m3r81f1lu9.fsf at jcooper02.sagepub.com>,
Jock Cooper <jockc at mail.com> wrote:
> "Terry Reedy" <tjreedy at udel.edu> writes:
> > The default-parameter hack which substituted for closures made lambdas
> > then more awkward, but I believe they were mostly just as useful as
> > today as callbacks and as HOF args. In any case, closures were
> > introduced over two years ago in 2.1, and your original statement says
> > 'is', not 'used to be some years ago'.
>
> Isn't it true though that the lambda can only contain a single expression
> and no statements? That seems to limit closures somewhat.
It limits lambdas. It doesn't limit named functions. Unlike lisp, a
Python function definition can be nested within a function call, and the
inner function can access variables in the outer function's closure.
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-list
mailing list