lexical closures and python

John Beppu beppu at binq.org
Thu Sep 6 01:56:09 EDT 2001


Hi,

My understanding is that Python does not support lexical closures.
I've also heard that it should not be expected to appear any time
in the near future.  Can anyone confirm or deny this?

I want to know, because I'm writing a piece that talks a lot
about Scheme, and I was comparing it to a lot of scripting languages
that are out there -- Perl, Python, Ruby, and even JavaScript...
It seemed strange to me that of all these languages, Python was the
one that didn't support lexical closures.  (On the other hand, I was 
surpised to find out that JavaScript _did_ support lexical closures).

I'm asking about closures here, because I didn't want to misrepresent
Python in my writing.  If lexical closures are on the horizon, I'd
like to know about it.  If not, I guess I could mention that Python
provides a lambda function, but it's not what a Schemer would expect
it to be.  I'm trying to be correct, here.

Anyway, I'd appreciate any help I can get.
Thanks.





More information about the Python-list mailing list