[Numpy-discussion] Re: ndarray.fill and ma.array.filled
Tim Hochberg
tim.hochberg at cox.net
Fri Apr 7 18:44:02 EDT 2006
Sasha wrote:
>On 4/7/06, Tim Hochberg <tim.hochberg at cox.net> wrote:
>
>
>>[...]
>>Perhaps MaskedArray should inherit from ndarray for the time being. Many
>>of the methods would need to reimplemented anyway, but it would make
>>asanyarray work. Someone was just complaining about asarray munging his
>>arrays. That's correct behaviour, but it would be nice if asanyarray did
>>the right thing. I suppose we could just special case asanyarray to
>>ignore MaskedArrays, that might be better since it's less constraining
>>from an implementation side too.
>>
>>
>>
>Just for the record. Currently MA does not inherit from ndarray.
>
>
Right, I checked that. That's why asanyarray won't work now with MA
(unless someone changed the implementation of that while I wan't looking.
>There are some benefits to be gained from changing MA design from
>containment to inheritance, by I am very sceptical about the use of
>inheritance in the array setting.
>
>
That's probably a sensible position.
Still it would be nice to have asanyarray pass masked arrays through
somehow. I haven't thought this through very well, but I wonder if it
would make sense for asanyarray to pass any object that supplies
__array__. I'm leary of special casing asanyarray just for MA; somehow
that seems the wrong approach.
>>This may be an oportune time to propose something that's been cooking in
>>the back of my head for a week or so now: A stripped down array
>>superclass.
>>
>>
>
>This is a very worthwhile idea and I hate to see it burried in a
>non-descriptive thread. I've copied your proposal to the wiki at
><http://projects.scipy.org/scipy/numpy/wiki/ArraySuperClass>.
>
>
Thanks for doing that. I'm glad you like the general idea. I do plan to
write it through and try to get a better handle on what this would
entail and what the consequences would be. However, I'm not sure exactly
when I'll get around to it so it's probably better that a rough draft be
out there for people to think about in the interim.
-tim
>
>
>
More information about the NumPy-Discussion
mailing list