Cython的基础语法

来源:互联网 发布:iphone照片传到电脑mac 编辑:程序博客网 时间:2024/05/16 11:43

原英文链接:

http://docs.cython.org/en/latest/src/userguide/language_basics.html#language-basics



C变量与类型定义

cdef语句用于声明C变量,既可以声明局部变量也可以声明全局变量:

cdef int i, j, kcdef float f, g[42], *h


Cython的C结构、联合与枚举类型定义如下:

cdef struct Grail:    int age    float volumecdef union Food:    char *spam    float *eggscdef enum CheeseType:    cheddar, edam,    camembertcdef enum CheeseState:    hard = 1    soft = 2    runny = 3



0 0
原创粉丝点击