[Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()

Stefan van der Walt stefan@sun.ac...
Fri Nov 23 09:05:54 CST 2007


Hi Sebastian

On Fri, Nov 23, 2007 at 09:25:37AM +0100, Sebastian Haase wrote:
> Hi,
> this question might habe been answered before:
> I have my own ndarray-derived class. I did this, so that I can add
> another "custom attribute" -- let's say
> arr.filename
> All works very except, except when I do
> arr2 = arr.transpose()
> my arr2 is still of the *type* of my derived class, however trying a
> arr2.filename
> now gives me an AtttributeError.
> 
> What am I doing wrong? How can this be fixed?
> (I'm using numpy 1.0.1 - please let me know if this has been fixed
> since)

Show us the code, then we can take a look.  I assume you have read

http://www.scipy.org/Subclasses

Regards
Stéfan


More information about the Numpy-discussion mailing list