What's New in Python 2.5

Filed under

It's hard to believe Python is more than 15 years old already. While that may seem old for a programming language, in the case of Python it means the language is mature. In spite of its age, the newest versions of Python are powerful, providing everything you would expect from a modern programming language. This article provides a rundown of the new and important features of Python 2.5.

I assume that you're familiar with Python and aren't looking for an introductory tutorial, although in some cases I do introduce some of the material, such as generators.

Changes and Enhancements to the Language Itself

Python 2.5 includes many useful improvements to the language. None of the changes are huge; nor do they require changes to your existing 2.4 code.

Conditional Expressions

Other languages, particularly C and C++, have for years allowed conditional expressions, which are expressions that include an if statement. The idea is simple: You have a variable, and you want to set the variable to one value if some condition is true; otherwise, you want to set the variable to another variable.

Certainly, you could always do this in Python using a block if statement like so:

Full Story.