It's somewhere in between. It's not supported and the Cython people know about it.
http://trac.cython.org/cython_trac/ticket/113
I tried two different things:
cdef get_list():
cdef double *a_radial = [25932.1070099 , 0.914825434095 , -177.588568125 , -0.237052788124 , -172347.610527 , -12.0687599808 , -0.0128861161041 , -151.202604262 , -0.999674457769 , 0.0161435039267 , 0.825533456725]
return a_radial
And
def get_list():
cdef double *a_radial = [25932.1070099 , 0.914825434095 , -177.588568125 , -0.237052788124 , -172347.610527 , -12.0687599808 , -0.0128861161041 , -151.202604262 , -0.999674457769 , 0.0161435039267 , 0.825533456725]
return a_radial
Both times it would not compile properly. It seems to be REALLY unsupported.
I was able to coerce Cython to allow me to make a static array, but only inside of a method call. That makes me think they know where to put the array in those cases (the stack) but at the module level, where does it go? The heap? What's the mechanism for allocating it? Also if you want to access the array in pure-python mode you'll need to convert it to something that python understands, and it doesn't understand a C array. You can only return Python objects or things which Cython can automatically turn into Python objects.
If performance is an issue then keeping this in the C-mode code shouldn't be a problem. If you need to get it to python-mode what's wrong with declaring a static array in one place and a python list as well. They can be a line apart to make updating easy.
cdef class Fun:
a_radial = [25932.1070099 , 0.914825434095 , -177.588568125 , -0.237052788124 , -172347.610527 , -12.0687599808 , -0.0128861161041 , -151.202604262 , -0.999674457769 , 0.0161435039267 , 0.825533456725]
def do_calcs(self):
cdef double *a_radial = [25932.1070099 , 0.914825434095 , -177.588568125 , -0.237052788124 , -172347.610527 , -12.0687599808 , -0.0128861161041 , -151.202604262 , -0.999674457769 , 0.0161435039267 , 0.825533456725]
print a_radial[0]
Can you not wrap all your performance sensitive stuff into a single python method call? I was able to also locate the static array inside a single function:
def do_calcs():
cdef double *a_radial = [25932.1070099 , 0.914825434095 , -177.588568125 , -0.237052788124 , -172347.610527 , -12.0687599808 , -0.0128861161041 , -151.202604262 , -0.999674457769 , 0.0161435039267 , 0.825533456725]
print a_radial[0]
Why does the static array need to be allocated outside of a function call?