A critic of Guido's blog on Python's lambda

Ken Tilton kentilton at gmail.com
Fri May 12 21:11:20 CEST 2006

Alexander Schmolck wrote:
> jayessay <nospam at foo.com> writes:
>>"Michele Simionato" <michele.simionato at gmail.com> writes:
>>>I was interested in a proof of concept, to show that Python can
>>>emulate Lisp special variables with no big effort.
>>OK, but the sort of "proof of concept" given here is something you can
>>hack up in pretty much anything. 
> Care to provide e.g. a java equivalent?

I think the point is that, with the variable actually being just a 
string and with dedicated new explicit functions required as 
"accessors", well, you could hack that up in any language with 
dictionaries. It is the beginnings of an interpreter, not Python itself 
even feigning special behavior.

perhaps the way to go is to take the Common Lisp:

     (DEFVAR *x*)

     *x* = special_var(v=42) ;; I made this syntax up

that could make for cleaner code:

     *x*.v = 1

     print *x*.v -> 1

(Can we hide the .v?) But there is still the problem of knowing when to 
revert a value to its prior binding when the scope of some WITH block is 

Of course that is what indentation is for in Python, so... is that 
extensible by application code? Or would this require Python internals work?


Cells: http://common-lisp.net/project/cells/

"Have you ever been in a relationship?"
    Attorney for Mary Winkler, confessed killer of her
    minister husband, when asked if the couple had
    marital problems.

More information about the Python-list mailing list