Here are all of the changes that Python 2.5 makes to the core Python language.
key
keyword argument analogous to the key
argument for sort(). This argument supplies a function
that takes a single argument and is called for every value in the list;
min()/max() will return the element with the
smallest/largest return value from this function.
For example, to find the longest string in a list, you can do:
L = ['medium', 'longest', 'short'] # Prints 'longest' print max(L, key=len) # Prints 'short', because lexicographically 'short' has the largest value print max(L)
(Contributed by Steven Bethard and Raymond Hettinger.)
class C(): pass
The net result of the 2.5 optimizations is that Python 2.5 runs the pystone benchmark around XX% faster than Python 2.4.
See About this document... for information on suggesting changes.