[Numpy-discussion] Feedback on new argument positions for ma.dot and MaskedArray.dot

Eric Firing efiring at hawaii.edu
Sun Nov 8 21:00:25 EST 2015


On 2015/11/08 3:46 PM, Charles R Harris wrote:
> Hi All,
>
> I'd like some feedback for the position of the `strict` and `out`
> arguments for masked arrays. See gh-6653
> <https://github.com/numpy/numpy/pull/6653> for the PR in question.
>
> Current status without #6652
>
>  1. ma.dot(a, b, strict=False) -- established
>  2. a.dot(b, out=None) -- new in 1.10
>
>
> Note that 1. requires adding `out` to the end for backward
> compatibility. OTOH, 2. is new(ish). We can either keep it compatible
> with ndarray.dot and add `strict` to the end and have it incompatible
> with 1., or, slightly changing it in 1.10.2, make it compatible with
> with 1. but incompatible with ndarray. We will face the same sort of
> problem with adding newer ndarray arguments other existing ma functions
> that have their own specialized arguments, so having a policy up front
> will be helpful. My own inclination here is to keep 1. and 2.
> compatible, and then perhaps at some point following a future warning,
> make both `strict` and `out` keyword arguments only. Another possiblitly
> is to make that transition immediate for the method.

I'm not sure about the best sequence, but I like the strategy of moving 
to keyword-only arguments.  It is good for readability, and for flexibility.

I also prefer that there be a single convention: either the "out" kwarg 
is the end of the every signature, or it is the first kwarg in every 
signature.  It's a very special and unusual kwarg, so it should have a 
standard location.

Eric

>
> Thoughts?
>
> Chuck
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>




More information about the NumPy-Discussion mailing list