[Python-3000] 3to2
VanL
van.lindberg at gmail.com
Tue Apr 1 13:54:45 CEST 2008
I know there has been some discussion of a 3to2 tool for easing porting.
The PyPy team has created at least the start of such a tool:
"Under the hood, the 2to3 conversion tool operates as a graph
transformer: it takes the graph of your program (in the form of Python
2.x source file) and returns a transformed graph of the same program (in
the form of Python 3.0 source file). Since the entire translation
toolchain of PyPy is based on graph transformations, we could reuse it
to modify the behaviour of the 2to3 tool. We wrote a general
graph-inverter algorithm which, as the name suggests, takes a graph
transformation and build the inverse transformation; then, we applied
the graph inverter to 2to3, getting something that we called 3to2: it is
important to underline that 3to2 was built by automatically analysing
2to3 and reversing its operation with only the help of a few manual
hints. For this reason and because we are not keeping generated files
under version control, we do not need to maintain this new tool in the
Subversion repository.
Once we built 3to2, it was relatively easy to pipe its result to our
interpreter, getting something that can run Python 3.0 programs."
From
http://morepypy.blogspot.com/2008/04/trying-to-get-pypy-to-run-on-python-30.html
Thanks,
Van
More information about the Python-3000
mailing list