Skip to content


Subversion checkout URL

You can clone with
Download ZIP

enhancements inline

robertwb edited this page · 6 revisions
Clone this wiki locally

CEP 109 - Runtime compilation

  • Status: Released as part of 0.14 (December 2010)


One very useful feature for fast prototyping of code is weave.inline, which allows one to compile inline chunks of code on the fly. Specialized code is compiled based on the types of inline variables (pulled from the surrounding scope), and cached for later use. A simple usecase would be

import cython

cython.inline("print x*x", x=3)

To get a result back, the return statement is used, e.g.

a = 100.
result = cython.inline("return a + 1")

Assuming we can get the source, we can also do

def f(x, y, z):

Numpy array types are optimized as well.

Something went wrong with that request. Please try again.