[Numpy-discussion] my derived ndarray class object loses its attribute after a transpose()
Sebastian Haase
haase at msg.ucsf.edu
Sat Nov 24 08:17:06 EST 2007
On Nov 23, 2007 5:18 PM, Pierre GM <pgmdevlist at 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):
N.ndarray.__new__(**options)
, right?)
-Sebastian
More information about the NumPy-Discussion
mailing list