[Pyrex] Re: return pointer

Greg Ewing greg at cosc.canterbury.ac.nz
Wed Apr 30 01:50:54 CEST 2003


Haris Bogdanovic <haris at email.hinet.hr> writes:

> Can Python function ("def") return a pointer to some struct ?  This
> function wouldn't be called from Python, only from Pyrex so I guess
> it's OK ?

No, it's impossible for a Python function to return
anything which can't be automatically converted to a
Python object.

But if the function is never called from Python, it
doesn't have to be a Python function. Make it a C
function (using cdef). Then it can accept and return
anything, and calling it will be faster, too.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list