Saturday, August 26, 2006

Sprint Report

I worked on a source-to-source translation system at the Google Python sprint. The system is intended to allow us to write transformations that upgrade programs from Python 2.x to Python 3.x. I finished a toy example that demonstrated that the approach will work. I translated a small program that use has_key to an equivalent program that uses in.
d = dict(x=1)
if d.has_key("x"):
print "yes"
else:
print "no"
Is transformed to
d = dict(x=1)
if "x" in d :
print "yes"
else:
print "no"
(Yes. There are 13 spaces between the d and the :.) The code is checked into the Python sandbox under refactor. I had a bunch of helpful conversations and did a little pair programming with Martin von Loewis.

Guido wrote a summary post about the Python 3000 sprint work. Update: I fleshed out many of the details in several subsequent posts.

1 comment:

Jeremy Hylton said...

There were 13 spaces between the d and the colon in the original code.