19.9.06

Python 2.5 is out!

Python
So, Python 2.5 is finaly out!

I'm not coding much in Python this days, specially not using Python to do real stuff (just some simple scripts), but you have to love this new release.

Besides being faster and more reliable, it has some awesome new language stuff, like the new "with" operator: it will turn try/finally blocks from
        VAR = EXPR
        VAR.__enter__()
        try:
            BLOCK
        finally:
            VAR.__exit__()

into
        with VAR = EXPR:
            BLOCK

... Awesome, heh?

Also, generators now have push, throw and close methods. And this is to Perl coders like me: I also liked the fact that Perl lets you do stuff like
$a = 3 if $b == 1;

, but Python 2.5 will let you do not only that, but
$a = 3 if $b == 1 else $a = 2

!!!

Finally, let me quote two other things that left me excited:

New builtins any and all evaluate whether an iterator contains any or all True values, respectively.

min and max gained a key keyword parameter, analogous to sort.