> First try seems to show that just changing my class def to:
>         class ndarray_inMrcFile(N.memmap):
>              def __array_finalize__(self,obj):
>                   self.Mrc = getattr(obj, 'Mrc', None)
>
> Seems to add the wanted attribute back into result of transpose().

Yep. Specific subclass attributes should be defined in __array_finalize__.

> However now I get (many!) exceptions like:
> Exception exceptions.AttributeError: "'ndarray_inMrcFile' object has no
> attribut e '_mmap'" in <bound method ndarray_inMrcFile.__del__ of
> ndarray_inMrcFile([ 6,....
>
> Do I need to call super.__array_finalize__(obj) first ?

Nope, you just need a __new__ that calls the __new__ of you parent class. Keep 
it minimal.
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to