[Python-Dev] Please Vote -- Generator Comprehensions

Samuele Pedroni pedroni@inf.ethz.ch
Thu, 7 Mar 2002 08:10:09 +0100


From: Martin v. Loewis <martin@v.loewis.de>
> "Raymond Hettinger" <python@rcn.com> writes:
> 
> > Before I send generator comprehension portion to Guido for
> > pronouncement, I would like to get all of your votes +1 or -1 on
> > just the part about Generator Comprehensions.
> 
> +0. I'd like to see an implementation strategy first. Notice that the
> strategy for list comprehension does *not* apply: it is not lazy.
> 

Hypothesis:

Given that a frame, new scope and nested scope semantics
is required the rewriting as a generator is probably the strategy,
although I don't know whether the CPython internal syntax trees
allow for a direct rewriting strategy.

Otherwise code that handles the syntax as if it was
the rewritten generator is needed, in order to the deal
both for the pass that gathers nested scope
information and for the pass that generates the code.

regards, Samuele Pedroni.