Hi,
I ran into a rather basic problem where I can't seem to change the value of
a module-level Cython variable through a cpdef'd Cython function. I have the
following:
#foo.pyx
cdef float foovar = 0.001
cpdef float get_foo():
return foovar
cpdef set_foo(float v=0.001):
foovar = v
When I call get_foo() at the Python interpreter I get the value 0.001, but
trying to change foovar's value with set_foo() has no effect. I also tried
to cpdef foovar but that didn't help. I could probably (?) define foovar as
a regular Python variable, but I'd rather have it as a Cython variable for
speed. Is there anything special that needs to be done to get this to work?
Thanks,
J.S.
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev