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

Sebastian Haase haase@msg.ucsf....
Sat Nov 24 07:17:06 CST 2007

On Nov 23, 2007 5:18 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
> > 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...
One more question on this:
If I really don't need the memmap features explicitely anymore, and
decide to derive from N.ndarray:
Is it correct to assume that  N.ndarray does *not* do it's own
N.ndarray.__new__(**options) or so, that I would have to call ?
(In other words: If I derive from N.ndarray I do not need to do a
def __new__(**options):
, right?)


More information about the Numpy-discussion mailing list