[Numpy-discussion] Subclassing ndarray with concatenate

Todd toddrjen@gmail....
Tue Jan 22 03:21:03 CST 2013


I am trying to create a subclass of ndarray that has additional
attributes.  These attributes are maintained with most numpy functions if
__array_finalize__ is used.

The main exception I have found is concatenate (and hstack/vstack, which
just wrap concatenate).  In this case, __array_finalize__ is passed an
array that has already been stripped of the additional attributes, and I
don't see a way to recover this information.

In my particular case at least, there are clear ways to handle corner cases
(like being passed a class that lacks these attributes), so in principle
there no problem handling concatenate in a general way, assuming I can get
access to the attributes.

So is there any way to subclass ndarray in such a way that concatenate can
be handled properly?

I have been looking extensively online, but have not been able to find a
clear answer on how to do this, or if there even is a way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130122/e09471e1/attachment.html 


More information about the NumPy-Discussion mailing list