[Pyrex] Subclassing numpy.ndarray with Pyrex
Pierre GM
pgmdevlist at gmail.com
Tue Feb 6 20:43:23 UTC 2007
> 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.
Indeed. Well, thanks anyway
> Do you really need to subclass ndarray? Could you
> get what you want using a different class that
> wraps an ndarray instead?
Oh, I tried creating objects in Pyrex that use ndarrays as attributes, and
that works pretty well indeed. However, numpy does not recognize them as
arrays. Functions using the numpy.asanyarray trick would transform them in
basic ndarrays, thus ripping off any specific attributes.
The more it goes, the less comfortable I am with direct subclassing of
ndarrays anyway...
More information about the Pyrex
mailing list