kwgoodman/bottleneck — pull request #44 by dougalsutherland (2012-04-27 17:56:05+00:00)
Title: Python 3 support

These changes tweak the syntax of the pure-Python components of the code to be compatible with both Python 2 and 3, as well as accounting for some semantic changes. Luckily, Cython's syntactic chimerism means that most of the code could stay unchanged.

The only change that has any negative impact on Python 2 is that there are now some instances of `list(range)`, which needlessly copies the list created by `range`; this only happens in the template code and some testing code, and never with big lists (I think only ever on `range(ary.ndim)`), so it shouldn't be too bad.

I've successfully made the templates, built the library, and run `bn.test()` and `bn.bench()` with Python 2.6, 2.7, and 3.2 on OSX, as well as with Python 2.6, 2.7, and 3.2 on Debian. Python 2.5 works the same on Debian as it did before (two test failures because `nanargmin` and `nanargmax` disagree on what should happen when an entire row is `nan`; bench completes succesfully).

Someone should test on Windows, and I haven't verified that output is identical between 2.* and 3.*, but I think this should otherwise be ready to merge.