Category : cython

I’m making an interface between Python and Fortran code with Cython. One part of that is retrieving arrays of strings. In Fortran, character(len=3) :: str_array(:) For the sake of this example, suppose str_array contains the following allocate(str_array(2)) str_array = [‘abc’,’def’] My approach is to return this to Cython as a single C char array. I ..

Read more

with the goal of executing a block of code, some involving Python scripts, in Android OS, I converted a Python script to C via Cython as follows. setup.py has this: from setuptools import setup from Cython.Build import cythonize from Cython.Compiler import Options Options.embed = "main" setup( ext_modules = cythonize("make_region.pyx") ) Next, do the conversion to ..

Read more

In Cython, you can define getter and setter functions for class properties: cdef class module property a: def __get__(self): cdef int a get_a(&a) return a def __set__(self, int a): set_a(&a) Is there a way to define getters and setters at the module level? For example, the syntax might look something like this. @module_property def a(): ..

Read more