On Sat, Jul 31, 2010 at 1:21 AM, Simon King <simon.k...@nuigalway.ie> wrote: > Hi Jeroen! > > On 31 Jul., 02:30, Robert Bradshaw <rober...@math.washington.edu> > wrote: >> ... >> > In file A.pyx, I have >> > cdef MyClass myobj >> > cdef class MyClass: >> > [...] >> >> > In file A.pxd, I have >> > cdef class MyClass: >> > [...] >> >> > In file B.pyx, I would like to access "myobj" from A.pyx, but how? >> >> You can't access cdef members of Cython modules from other modules >> (yet). Here you'd probably want to make an accessors method in A. >> Either that our you could not declare it as a MyClass (but in that >> case it'd be just a normal Python object). > > Would this work? > > in A.pyx: > myobj_py = MyClass(...) > cdef MyClass myobj = myobj_py > cdef class MyClass ... > > in A.pxd > cdef class MyClass: > [...] > > in B.pyx: > from A import myobj_py > from A cimport MyClass > cdef MyClass myobj = myobj_py > > In that way, you have the cdef object myobj in both A and B
Yep. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org