[Numpy-discussion] another view puzzle

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Jun 3 19:25:08 EDT 2009


On Wed, Jun 3, 2009 at 7:21 PM, Pierre GM <pgmdevlist at gmail.com> wrote:
>
> On Jun 3, 2009, at 7:00 PM, Robert Kern wrote:
>
>> On Wed, Jun 3, 2009 at 17:58,  <josef.pktd at gmail.com> wrote:
>>> Do you have an opinion about whether  .view(ndarray_subclass) or
>>> __array_wrap__ is the more appropriate return wrapper for function
>>> such as the ones in stats?
>>
>> __array_wrap__ would be more appropriate. It's what ufuncs use.
>
> And it would work w/ MaskedArrays (using a simple .view(MaskedArray)
> would wipe out some information, while MaskedArray.__array_wrap__
> keeps it)


Thanks to all, this has been very informative.
I added Roberts comments to the np.ndarray.view docstring and will add
examples (to structured arrays) as I find time.

Josef
Josef



More information about the NumPy-Discussion mailing list