Thursday, October 02, 2008

Some Python 2.6 notes

From the release notes:

Python 3.0 adds several new built-in functions and changes the semantics of some existing built-ins. Functions that are new in 3.0 such as bin() have simply been added to Python 2.6, but existing built-ins haven’t been changed; instead, the future_builtins module has versions with the new 3.0 semantics. Code written to be compatible with 3.0 can do from future_builtins import hex, map as necessary.

A new command-line switch, -3, enables warnings about features that will be removed in Python 3.0. You can run code with this switch to see how much work will be necessary to port code to 3.0. The value of this switch is available to Python code as the boolean variable sys.py3kwarning, and to C extension code as Py_Py3kWarningFlag.