[Pyrex] Access to nested structures and arrays

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 20 00:42:32 UTC 2007


Pierre GM wrote:

> And define "parameter_flags" as a "model flag" instance.
 > And I can't set it to public as it's a non-generic one.

Okay, I see what the problem is now. Pyrex disallows
writable non-generic public attributes because the mechanism
for accessing them doesn't allow for performing a type check,
so there would be nothing to stop Python code from assigning
an object of the wrong type.

You can expose it readonly, however:

    cdef class loess_model:
       cdef readonly modelflags parameter_flags

(It's only readonly from Python code -- Pyrex still has
full access to it.)

Is this sufficient for what you want to do?

--
Greg



More information about the Pyrex mailing list