Python syntax in Lisp and Scheme
David Eppstein
eppstein at ics.uci.edu
Tue Oct 14 20:22:00 EDT 2003
In article <eppstein-434779.17173814102003 at news.service.uci.edu>,
David Eppstein <eppstein at ics.uci.edu> wrote:
> > 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.
To clarify, by "unlike lisp" I meant only that defun doesn't nest (at
least in the lisps I've programmed) -- of course you could use flet, or
bind a variable to a lambda, or whatever.
--
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