There’s a slight change in the behavior of os.path.splitext because of a bug current versions of Python do have:
[code lang="python"] Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type “help”, “copyright”, “credits” or “license” for more information.
from os.path import splitext splitext(’.cshrc’) (”, ‘.cshrc’) [/code]
becomes:
[code lang="python"] Python 2.6a0 (trunk:54262, Mar 10 2007, 18:06:14) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type “help”, “copyright”, “credits” or “license” for more information.
from os.path import splitext splitext(’.cshrc’) (’.cshrc’, ”) [/code]
You can now pass a TestRunner instance to unittest.main() and run doctest from the command line against your beloved Python with python -m doctest file.py.
Another new feature is open() in ZipFile objects allowing you to read a file inside an archive directly:
[code lang="python"]
import zipfile zf = zipfile.ZipFile(’README.zip’) f = zf.open(’README’) print f.read() Hello [/code]
The tuple() object is great to store struct-like data but it’s accessible only through numeric indexes so in Python 2.6 you can use also named tuples like:
[code lang="python"]
from collections import NamedTuple Point = NamedTuple(’Point’, ‘x y’) p = Point(10, 5) p.x 10 p.y 5 [/code]
It behaves like a normal tuple so you can use it everywhere. See the full documentation.
There’s also a bunch of fixes or additions in networking-related modules like support for LMTP in smtplib, HTTP_REFERER support in CGIHTTPServer and more.
As usual, the very source of information for what’s new are the SVN logs or the NEWS file.

