[Numpy-discussion] Warnings in numpy.ma.test()

Darren Dale dsdale24@gmail....
Wed Mar 17 16:13:44 CDT 2010


On Wed, Mar 17, 2010 at 4:48 PM, Pierre GM <pgmdevlist@gmail.com> wrote:
> On Mar 17, 2010, at 8:19 AM, Darren Dale wrote:
>>
>> I started thinking about a third method called __input_prepare__ that
>> would be called on the way into the ufunc, which would allow you to
>> intercept the input and pass a somehow modified copy back to the
>> ufunc. The total flow would be:
>>
>> 1) Call myufunc(x, y[, z])
>> 2) myufunc calls ?.__input_prepare__(myufunc, x, y), which returns x',
>> y' (or simply passes through x,y by default)
>> 3) myufunc creates the output array z (if not specified) and calls
>> ?.__array_prepare__(z, (myufunc, x, y, ...))
>> 4) myufunc finally gets around to performing the calculation
>> 5) myufunc calls ?.__array_wrap__(z, (myufunc, x, y, ...)) and returns
>> the result to the caller
>>
>> Is this general enough for your use case? I haven't tried to think
>> about how to change some global state at one point and change it back
>> at another, that seems like a bad idea and difficult to support.
>
>
> Sounds like a good plan. If we could find a way to merge the first two (__input_prepare__ and __array_prepare__), that'd be ideal.

I think it is better to keep them separate, so we don't have one
method that is trying to do too much. It would be easier to explain in
the documentation.

I may not have much time to look into this until after Monday. Is
there a deadline we need to consider?

Darren


More information about the NumPy-Discussion mailing list