maciejkula/glove-python — pull request #10 by ogrisel (2014-11-06 16:05:14+00:00)
Title: FIX Python 3 compat

Here is a final batch of Python 3 compat. I finally got the opportunity to run the full example under Python 3.

Note that I had troubles building the project under Python from python.org as distutils / setuptools told GCC to build fat binaries (32 and 64bits architectures). This is not supported by default under the real GCC (only with the apple GCC-LLVM frontend that does not support openmp hence cannot be used for this project).

So I installed Python 3 from homebrew to test and the example works now (with those fixes).

Python 2 should still work although I have not re-tested it till the end. Note that I replaced all `xrange` occurrences to `range`. As all iterations are short (couple of tens to couple of thousands) the incurred extra memory usage under Python 2 should be negligible. If not, it's possible to use a `try: xrange / except NameError: xrange = range` hack or even to use something like http://python-future.org/ but that seems overkill in this case.

In cython files, `xrange` and `range` are synonyms, but `range` looks more modern.