[Python-checkins] r51731 - python/trunk/Python/ast.c

Georg Brandl g.brandl at gmx.net
Tue Sep 5 14:48:57 CEST 2006


Nick Coghlan wrote:
> neal.norwitz wrote:
>> +/* XXX(nnorwitz): the listcomp and genexpr code should be refactored
>> +   so there is only a single version.  Possibly for loops can also re-use
>> +   the code.
>> +*/
> 
> I believe I tried to do exactly that back before the AST compiler landed on 
> the trunk. As I recall, the code generated turned out to be sufficiently 
> different in structure (a for loop instead of an anonymous generator function) 
> that it didn't seem practical to combine them.

That's what I saw when I looked at the code. For my set comprehension patch
(on SF) I unified all comprehensions so that listcomps are also executed in
an anonymous function, hence the code is unified too.

Georg



More information about the Python-checkins mailing list