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

Pierre GM pgmdevlist@gmail....
Fri Nov 23 10:18:53 CST 2007


> This seems to work without any problem now:
>         class ndarray_inMrcFile(N.ndarray):
>             def __array_finalize__(self,obj):
>                 self.Mrc = getattr(obj, 'Mrc', None)
>
> Comments?

That should work if you want a subclass of ndarray. That probably won't if you 
want a subclass of memmap. Once again, I'd do a 
def __new__(**options)
   N.memmap.__new__(**options)
or something to this effect...


More information about the Numpy-discussion mailing list