This morning, Guido announced the creation of a refactoring tool for Python. In the link I’ve posted above, Guido mentioned that this could serve as a tool which could facilitate migrating code from Python 2.x to 3.0.
The gist of the tool is that it generates a parse tree of a piece of code. It then starts looking for nodes in the tree which match some pattern. When it finds matching nodes, it applies matching rules to matching nodes and “grafts” the resulting transformed node back into the parse tree.
I have just downloaded the source code for the refactoring tool, so I haven’t gotten my hands dirty with the code just yet, but it looks interesting and promising. Guido’s purpose in announcing the tool was to invite people to try it and give him a hand if you’re so inclined. So, go download it and put it through its paces.