[Cython] [cython-users] Re: callback function pointer problem

Robert Bradshaw robertwb at math.washington.edu
Wed Oct 5 09:45:25 CEST 2011

On Fri, Sep 30, 2011 at 2:14 PM, Dag Sverre Seljebotn
<d.s.seljebotn at astro.uio.no> wrote:
> Are you saying that when coercing a struct to an object, one would copy
> scalar fields by value but reference array fields? -1, that would be
> confusing. Either the whole struct through a view, or copy it all.


> It bothers me that structs are passed by value in Cython, but it seems
> impossible to change that now. (i.e, once upon a time one could have
> required the use of a copy method to do a struct assignment and give a
> syntax error otherwise, which would have worked nicer with Python
> semantics).

Of course, to do otherwise would have resulted in "pure C" code
behaving very differently from C and messy issues like "cdef int
f(struct_type a)" either meaning different things in an extern block
or not mapping to the "obvious" C signature.

On this note, eventually I would like coerce structs (and unions,
enums) to auto-generated wrapper classes, visible in the Python module
namespace if one declares them as "cpdef struct ..." (even if they're

- Robert

More information about the cython-devel mailing list