[Numpy-discussion] Style for pad implementation in 'pad' namespace or functions under np.lib
Fri Mar 30 08:20:42 CDT 2012
> My suggestion is:
> Step 1: Change the current PR so that it has only one user-exposed
> function, something like pad(..., mode="foo"), and commit that.
> Everyone seems to pretty much like that interface, implementing it
> would take <1 hour of work, and then the basic functionality would be
> landed and done.
This is all done in my working directory.
Currently I have 'mode' as the first argument and not a keyword. Could you
explain the utility of having it be a keyword, if that is indeed what you
were advocating earlier?
Step 2: Add the option to pass a user-defined function as the mode=
> argument, since there's still uncertainty about the best way to do it
> and working through uncertainty adds time and risk that shouldn't hold
> up the parts that we do agree on.
This is done also. I don't do any checks. If it isn't a string, then I
take it to be a function.
The function signature is:
myfunc(vector, pad_tuple, iaxis, kwds)
and it has to return a rank 1 array the same length as the input `vector`
> Even if we do want to keep around the pad_with_mean, pad_with_median
> etc. functions as additional user-exposed entry-points, I think the
> current names in the PR met with objections? (The current names are
> like "np.lib.pad.pad_mean".)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion