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

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Mar 22 20:19:30 EST 2004


Guido:

> A free variable might be a function that itself references globals (or
> at least nonlocals) that might change.
> 
> There is also the issue of exceptions:

Oviously there will be semantic differences, but the question is
whether the consequences of them are serious enough to be worth
treating the outermost iterator differently from the others.

I'm disturbed by the number of special rules we seem to be needing to
make up in the name of getting generator expressions to DWIM. First we
have free variables getting captured, which is unprecedented anywhere
else; now we have some iterators being treated more equally than
others.

I'm getting an "architecture smell" here. Something is wrong
somewhere, and I don't think we're tinkering in the right place to fix
it properly.

I think I have an idea where the right place is, but I'll leave
that to another post. I suspect the idea isn't going to go down
well...

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list