[ACCEPTED]-How to use const in Cython-cython

Accepted answer
Score: 25

const works for function arguments, but not for 5 this construct because of how Cython compiles 4 it to C.

cdef double a = 2.5


double __pyx_v_a;
/* lots of other declarations */

__pyx_v_a = 2.5;

and this wouldn't work with 3 a const variable. In effect, you cannot use const in 2 Cython in all the places were you can use 1 it in C.

More Related questions