我可以使用Cython创建静态C数组吗?

Ric*_*ich 15 python arrays cython

我想在Cython中做到这一点:

cdef int shiftIndexes[] = [1,-1, 0, 2,-1, -1, 4, 0, -1, 8, 1, -1, 16, 1, 0, 32, 1, 1, 64, 0, 1, 128, -1, 1]
Run Code Online (Sandbox Code Playgroud)

我已经在固定的bug报告和旧的电子邮件列表中看到一些参考,Cython中存在静态数组功能,但是我找不到anty示例,这个特定的例子给我一个语法错误: Syntax error in C variable declaration

是否可以使用Cython制作静态C数组?

tit*_*ito 26

改为使用指针表示法:

cdef int *shiftIndexes = [1,-1, 0, 2,-1, -1, 4, 0, -1, 8, 1, -1, 16, 1, 0, 32, 1, 1, 64, 0, 1, 128, -1, 1]
Run Code Online (Sandbox Code Playgroud)

它会像魅力一样工作.