Friday, December 18, 2009

Converting Leo to Python 3K: surprises

This post will conclude the discussion of how I converted Leo to Python 3k. In fact, the work was mostly complete several weeks ago. Vacation got in the way of writing up these notes.

The biggest surprise was that almost all the surprises were good surprises. Aside from the complications previously discussed, porting Leo was a matter of running Leo and fixing the obvious problems reported by Python itself.

To recap, it took just a few days to get Leo to the point at which Leo could run its own unit tests with Python 3k. After that, it took just a few more hours, spread over several days, to get all the unit tests to pass.

Yesterday I completed the one and only "tricky" part of the port. This was a library problem. I won't bore you with the details: the problem arose from a mis-reading of the Python 3k docs. Today, as I was writing this post, I discovered my mistake and was able to clean up an ugly workaround.

So that's it. Porting a major app like Leo from Python 2.x to Python 3.x was almost completely straightforward.

Edward

2 comments:

  1. Will you be maintaining the 2.x version or is it time for everyone to dive into 3.x and convert the world!?

    I for one think it's time to show the popularity of Python by making the transition happen as quickly as possible.

    ReplyDelete
  2. > Will you be maintaining the 2.x version or is it time for everyone to dive into 3.x and convert the world!?

    Leo has a unified code base that will compile on both Python 2.6 and Python 3.1. This will remain true for the indefinite future.

    ReplyDelete