Adapted to the new numpy 1.7 API - not yet to the Npy_Iter API (PyArrayIter isn't deprecated yet).