[Numpy-discussion] Style for pad implementation in 'pad' namespace or functions under np.lib
Travis Oliphant
travis@continuum...
Thu Mar 29 20:55:31 CDT 2012
On Mar 29, 2012, at 12:53 PM, Tim Cera wrote:
> I was hoping pad would get finished some day. Maybe 1.9?
You have been a great sport about this process. I think it will result in something quite nice.
>
> Alright - I do like the idea of passing a function to pad, with a bunch of pre-made functions in place.
>
> Maybe something like:
>
> a = np.arange(10)
> b = pad('mean', a, 2, stat_length=3)
>
> where if the first argument is a string, use one of the built in functions.
>
> If instead you passed in a function:
>
> def padwithzeros(vector, pad_width, iaxis, **kwargs):
> bvector = np.zeros(pad_width[0])
> avector = np.zeros(pad_width[1])
> return bvector, avector
>
> b = pad(padwithzeros, a, 2)
>
> Would that have some goodness?
+1
-Travis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120329/cff754ac/attachment-0001.html
More information about the NumPy-Discussion
mailing list