[sugar] Education?

Guido van Rossum guido
Sun Mar 11 11:33:49 EDT 2007


On 3/11/07, Antoine van Gelder <hummingbird at hivemind.net> wrote:
> Anyone know the current status of being able to turn an AST tree emitted
> by the Python compiler module back into code after it has been modified ?

The word "code" is ambiguous in the context. If you meant byte code,
the final stage of the compiler should be able to do that just fine.
If you meant to turn a tree back into source code, I wrote a tool that
can do this for the purpose of transforming Python 2 source code into
Python 3 source code. It doesn't use the same parse tree datatype that
the compiler uses, but it's very handy for source-to-source
transformations, as it retains the exact formatting, comments etc. of
the input source code (to the extent possible given transformations,
of course). It's not yet documented, though I have a few users helping
out writing transformations already. Check it out in our repository:
http://svn.python.org/view/sandbox/trunk/2to3/

> :-)

I hope you weren't merely stating a rhetorical question.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Sugar-devel mailing list