[Python-Dev] An issue recently brought up in patch#872326(generator expression)

Guido van Rossum guido at python.org
Tue Mar 23 15:54:39 EST 2004


> > All this makes me lean towards getting rid of the binding capture
> > feature.  That way everybody will get bitten by the late binding fair
> > and square the first time they try it.
> 
> I prefer this approach over one that has subtleties and nuances.

I was partly inpsired to this position by reading a draft for Paul
Graham's new book, Hackers and Painters (which will include last
year's PyCon keynote on the 100-year language).  In one of his many
criticisms of Common Lisp (not his favorite Lisp dialect :), Paul
complains about hygienic macros that they are designed to take away
the power and sharp edges, but that for him the attraction of Lisp is
precisely in that power.

I think that in this particular case, late binding, with its sharp
edges, gives more power than binding capturing, and the latter, in its
attempts to smoothen the sharp edges, also takes away some power.

One way of deciding which option gives more power would be to see how
easy it is to implement the other option on top of it.  Implementing
binding capture on top of late binding is a solved problem in Python
(albeit not particularly elegant).  I have no idea how to implement
late binding under binding-capture; one would probably have to use
locals() or store the to-be-bound-late variables in a container.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list