[Pyrex] Subclassing numpy.ndarray with Pyrex

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 6 10:28:03 UTC 2007


Pierre GM wrote:
> When a sub-type is created in such a fashion, 
> however, neither the new method nor the init methods gets called.

Urk, this doesn't bode well for being able to subclass
ndarray in Pyrex. If the normal instance creation
mechanisms are bypassed, various things that Pyrex
relies on won't happen, such as initialisation of
Python-valued attributes. This could be the reason
you're getting crashes in odd places.

Things should still work if you do create an instance
in the normal way, however, so I'm not sure exactly
what's going on.

Do you really need to subclass ndarray? Could you
get what you want using a different class that
wraps an ndarray instead?

--
Greg



More information about the Pyrex mailing list