Thursday, December 4, 2008

Py3k is final.

As of 11:59pm EST, Python 3.0 has been released. If you're planning on upgrading, there is a very good chance that the "2to3" tool released with it (I believe it came with Python 2.6 as well) will be able to fix your code that worked with 2.x to again work with 3.0. Of course, make sure that it works in 2.x before running 2to3, or you might have a tough time figuring out what's wrong with your program.

See the first post of this blog for a list of the major things different from the upgrade.

Most important things:
raw_input() is no longer raw_ anymore, and just became input()
print is now a FUNCTION, not a statement. That means parentheses. (Get your fingers used to it now!) print(x), not print x.
integer division (int / int) returns a float! (int // int does the classic thing). Also longs.