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

Jeremy Hylton jeremy at alum.mit.edu
Tue Mar 23 16:30:34 EST 2004


On Tue, 2004-03-23 at 16:15, Samuele Pedroni wrote:
> At 12:54 23.03.2004 -0800, Guido van Rossum wrote:
> > > > 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.
> 
> hmm, I'm confused CL has non-hygienic macros, although you can workaround that
> using the package system or gensym,
>   Scheme has hygienic macros,

I believe Paul is definitely a fan of CL over Scheme.  Academic: "Paul,
that macro isn't hygenic."  Paul: "So tell my mother."

> the current list comprehension in Python e.g. behaves like an unhygienic macro:
> 
> x = 3
> l= [ l*2 for x in l]
> # x is not 3 anymore. 

I guess I prefer Scheme, because I'd like to see this fixed ;-).  I
don't think it's much like a macro, though.  The expanded code is
visible at the invocation site.

Jeremy





More information about the Python-Dev mailing list