[Numpy-discussion] another view puzzle

josef.pktd@gmai... josef.pktd@gmai...
Wed Jun 3 18:25:08 CDT 2009


On Wed, Jun 3, 2009 at 7:21 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
>
> On Jun 3, 2009, at 7:00 PM, Robert Kern wrote:
>
>> On Wed, Jun 3, 2009 at 17:58,  <josef.pktd@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