Just because you can do it in C doesnβt really mean you can do it in Cython.
The working environment can use global variables and class properties so that you can access them through class instances. I'm not sure if this is really better than using global variables though
import cython
cdef int MyClass_static_variable
cdef class MyClass:
property static_variable:
def __get__(self):
return MyClass_static_variable
def __set__(self, x):
global MyClass_static_variable
MyClass_static_variable = x
, (, , , __get__ __set__ cpdef, - ). , , , - MyClass.static_variable.