Python vs. Lisp -- please explain

Kay Schluehr kay.schluehr at gmx.net
Sun Feb 19 12:47:48 EST 2006


Roy Smith wrote:
> DH <no at spam.com> wrote:
> > -python has true closures (although nothing like ruby's blocks)
>
> What is a "true closure"?  Or, maybe what I'm asking is what kind of
> closure wouldn't be a true closure?  Is there some kind of ersatz closure
> other language try to pass off, in violation of truth in closure laws?

A "true closure" is what Python doesn't have ;)

If you enclose variables in a certain functional context in which they
are not defined they are turned into something immutable in Python.
Assigning a value to the same name creates a new object instead of
rebinding the old name. This "readonly" semantics confuses many
programmers coming from other languages at least all Lispers/Schemers
I've talked to. Python does not provide a rebinding operator for free
variables by BDFL decision.

Kay




More information about the Python-list mailing list