On 11/21/06, tomer filiba <[EMAIL PROTECTED]> wrote:
i read the references fredrik posted several days back, and it got me thinking: why not add a "co_ast" attribute to code objects? i.e., since (virtually) all code objects are constructed from source code by compilation, the compiler could just emit the AST as an attribute to the generated code object. yes, there's an issue of memory consumption, but bear with me for a moment. also, maybe co_ast could be a lazy attribute, reading the ast from the pyc file on demand.
Because the .pyc file does not store enough information for an easy bytecode->AST transformation. You would need to read from the source code and and reconstruct the AST. This is why, as of now, you need to go through compile() to get an AST. I personally would rather wait to see how much the AST is actually used before trying to give it an attribute on code objects. -Brett
_______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
