intertwingly

It’s just data

2to3


As a learning exercise, I tried converting the Universal Feed Parser to Python 3.0.  I picked it because it is a relatively self contained code base that I am familiar with, one that is actively in use, and one that has seen the wear and tear of dealing with compatibility (and the need to monkeypatch the occasional bug) of a number of Python releases.

$ svn co http://svn.python.org/projects/sandbox/trunk/2to3/
$ cd 2to3

$ python refactor.py -w ../feedparser/feedparser.py > feedparser.2to3.diff
root: Generating grammar tables from /home/rubys/svn/2to3/PatternGrammar.txt
root: Writing grammar tables to /home/rubys/svn/2to3/PatternGrammar.pickle
../feedparser/feedparser.py: At line 3091: You should use a for loop here
RefactoringTool: Files that were modified:
RefactoringTool: ../feedparser/feedparser.py

$ python refactor.py -w ../feedparser/feedparsertest.py > feedparsertest.2to3.diff
RefactoringTool: Files that were modified:
RefactoringTool: ../feedparser/feedparsertest.py

A few manual changes later, and 91% of the tests pass.  I’m confident that with a little more work, I could quickly get that to 99%, perhaps even to 100%.

The Good

The Bad

The Ugly