[Python-Dev] Optimization of Python ASTs: How should we deal with constant values? (original) (raw)

Thomas Lee tom at vector-seven.com
Fri May 9 03:51:08 CEST 2008


Nick Coghlan wrote:

Steve Holden wrote:

While not strictly related to the global statement, perhaps Adam refers to the possibility of optimizing away code with an assignment which would make a name be recognized as local? If you're worried about "yield" disappearing you should also be worried about assignments disappearing, since that might cause names to be interpreted as globals. And once you start annotating functions as generators or not, and variable names as locals or cell variables or globals, you're starting to build up a substantial fraction of the information that is already collected during the symtable construction pass. Perhaps the initial attempt at this should just focus on identifying those operations which have the potential to alter the results of the symtable construction, and leave those to the bytecode optimisation step for the moment. Doing the symtable pass twice seems fairly undesirable, even if it does let us trim some dead code out of the AST. Sounds good. We can always come back to it.

Cheers, T



More information about the Python-Dev mailing list