On Fri, Sep 30, 2011 at 2:14 PM, Dag Sverre Seljebotn
<d.s.seljeb...@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.

+1

> 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
extern).

- Robert
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to