Jon Olav Vik <jono...@...> writes: > == cynvector.pxd == > from sundials cimport * # sundials.pxd defines N_Vector > cdef class CythonNVector: > cdef N_Vector nvector > cpdef toarray(self) > == cynvector.pyx == [...] > cdef class CythonNVector: > cdef N_Vector nvector # <-- ERROR [...]
Gotcha: When I copied declarations from cynvector.pyx to cynvector.pxd, I should have removed the original "cdef N_Vector nvector" from the .pyx file. As it was, I got a "'nvector' redeclared" error when re-compiling my example. The reason I didn't see it at first is that I compiled cynvector.so just from cynvector.pyx first, before creating cynvector.pxd. To summarize: "Formal" declarations of object attributes in filename.pxd are automatically available in filename.pyx and should not be repeated there. (Functions and class definitions _are_ repeated, for implementation.) _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
