[Pyrex] array/list of extension type

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Nov 21 01:32:16 CET 2007


Tomas Sirny wrote:
> everytime I want to call method of
> Neuron as matrix[i], I must explicitly cast it with <Neuron>. So, how
> can I make it c array?

You can't. Pyrex doesn't allow object references as elements of
a C array or struct, because it wouldn't be able to keep track
of the reference counts.

You don't need an explict cast, though, if you do something like

   cdef Neuron n
   n = matrix[i]
   ...do something with n...

--
Greg



More information about the Pyrex mailing list