A couple more interesting tricks in Python 2.4:
Generator Comprehensions
Exactly like a list comprehension, but returns a generator object instead of a list. e.g:
(i for i in range(10) if (i % 2) == 0)
Decorators
Syntaxtic sugar for wrapping a function in another.
e.g:
def bar(f): ...
@bar
def foo(x): ...
Is equivalent to:
def bar(f): ...
def foo(x): ...
foo = bar(foo)