Compatibility with Python 3

It fixes compatibility with Python 3 but breaks compatibility with Python 2.5 or less.

http://docs.python.org/2/reference/datamodel.html#index-35