python - How to pass a module as an argument for struct in cython? -
i have no experience cython , started learning it. trying pass module argument to struct, don't know how? sample code tried in jupyter-notebook:
%load_ext cython %%cython cdef class a: pass cdef struct person: int num object info cdef person p1.idd = 94113 p1.info = a()
i appreciate me that.
trying replace python dict
lists in code self-designed structs because read here, it's not possible use nogil python dicts.
if find way overcome problem in way code runs fast possible, highly appreciated.
thanks.
the things can go c definition - cdef
describes - c types.
something start, if want keep using structs:
ctypedef struct info: char[256] address char[256] name <..> ctypedef struct person: int num info info cdef class person: cdef person my_struct
for simplicity, , since aim defined class , use object in python anyway, can make cdef class , let cython generate structures you.
cdef class person: cdef char[256] name cdef char[256] address cdef int num <..>
Comments
Post a Comment