Pyrex lets you write code that mixes Python and C data types any way you want, and compiles it into a C extension for Python.
Pyrex is a language specially designet, and compiles it into a C extension for Python.
Pyrex is a language specially designed for writing Python extension modules. It’s designed to bridge the gap between the nice, high-level, easy-to-use world of Python and the messy, low-level world of C.
For the basic types such as numbers and strings this is not too bad, but anything more elaborate and you’re into picking Python objects apart using the Python/C API calls, which requires you to be meticulous about maintaining reference counts, checking for errors at every step and cleaning up properly if anything goes wrong.
Pyrex is not quite a full superset of Python. The following restrictions apply:
- Function definitions (whether using def or cdef) cannot be nested within other function definitions.
- Class definitions can only appear at the top level of a module, not inside a function.
- The import * form of import is not allowed anywhere (other forms of the import statement are fine, though).
- Generators cannot be defined in Pyrex.
- The globals() and locals() functions cannot be used.
Download from: Homepage