I have been looking at the What’s new __of Python 2.5. There is some cool features inside it :

Conditional Expressions:

This stuff basically allow to do standard C idiom (that we found in every kind of derivative language) like

a = condition ? “true” : “false”

the weird part is that Guido Van-Rossum implemented this syntax :

x = true_value if condition else false_value

which we will have to get use to. I am not a big fan of this feature since it makes the code more obscure. But still could be useful for little scripts or quick hack.

Unified try/except/finally:

I like the inclusion of else in a try finally. I use to put everything in the try which was not really very good looked when now i can really try or else something. Make me easier to port some Java code to python as well and respect the logic of the java program.

The with statement:

This one is weird for me it’s basically a closure of variable allowing to do stuff like this :

with expression as variable:


#expression not here anymore

I am still wondering how and why to use that. But i guess it will come us when i will do some coding in Python 2.5.

Other interesting stuff:

Sqlite3 library default inclusion. The cool thing about this for Linux vendors is that it does not require the libsqlite3 library but link dynamically via the ctypes module (i guess).

Ctypes allow you to call C dynamic functions via python.

A fast new XML parser.

Sounds like fun for the new python and there is a lot of other bugfixes so go read it.