[Pyrex] Subclassing Numeric arrays

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 9 08:02:14 CEST 2005


George Sakkis wrote:
> I want to use Pyrex for making a custom extension of  Numeric arrays, but
> I don't know how. I tried the simplest possible subclass example but it
> seg faults; apparently it doesn't do what I thought it does:
> 
> cdef extern from "Numeric/arrayobject.h":
>     ctypedef class Numeric.ArrayType [object PyArrayObject]:
>         pass

I'm not even sure whether this is possible. An
extension class needs to be specially designed in
order to be subclassable, and Numeric was written
before the subclassable-types stuff existed.

Check whether you can subclass a Numeric array
in Python. If you can't do that, you won't be
able to do it in C or Pyrex either.

Greg




More information about the Pyrex mailing list