Skip to content


robertwb edited this page Jul 3, 2011 · 9 revisions
Clone this wiki locally

Update: this can now be handled automatically (and more selectively) via an option. See

Imagine this simple file:

The generated code is slow though, because range() is slow. I can either manually change all ranges to the "from 1 <= i <= dim -1" idiom, but that's annoying. I prefer Cython to do it automatically (for example by providing a switch "--convertrange" or something, it doesn't have to be default).

Here is a simple script which does that:

It opens a file, changes all range(..) to from ..., and prints the result to stdout. You need pyparsing to run it:

$ python exampleIn.pyx



Something went wrong with that request. Please try again.