Tuesday, July 22, 2008

OSCON: Python 3.0 conversion tutorial

This was actually more interesting than I was expecting. Anthony Baxter gave a full afternoon tutorial on the things that will change as we go to python 3.0 and some helpful hints on how to get there.

- Looks like python 2.7 is a pretty likely eventuality (but definitely nothing past 2.9 :)
- You can import in several features "from the future" in 2.6 to get some of the 3.0 flavor (print as a function, non-relative imports, etc).
- optional type declaration in function defs could be cool
- foo, *stuff, bar = my_list # will be awesome
- {1, 2, 3} # as explicit set constructor is handy
- lambda isn't going away (you knew that, I just like to remind you). But so long my old friend reduce... :(

I'm very interested to try out the 2to3 converter. Actually the word I want is probably scared. I think alot of my personal code will be fine but the code at work will be a bear to get converted. Well, maybe it will force more wide spread unit testing (the real goal of py3k).

In any case I left the session more interested in 3.0 and less afraid of the conversion process. But I have a feeling it will be a couple years before this happens at work.

No comments: