[Numpy-discussion] Style for pad implementation in 'pad' namespace or functions under np.lib

Tim Cera tim@cerazone....
Mon Apr 2 11:36:21 CDT 2012

On Mon, Apr 2, 2012 at 12:09 PM, Travis Oliphant <travis@continuum.io>wrote:

> The idea of using constants instead of strings throughout NumPy is an
> interesting one, but should be pushed to another thread and not hold up
> this particular PR.
> I like the suggestion of Nathaniel.   Let's get the PR committed with a
> single-function interface.   I like having the array as the first argument
> to that function (it is more consistent).   They keyword can be called mode
> or method
> Tim, what do you think of that?   Further developments can happen in a
> separate PR.

Current pull request has a single pad function with the
mode/method/whatever you call it as a string OR function as the first

pad('mean', a, 5)
pad('median', a, 7)
pad(paddingfunction, a, 2)

I like the strings, maybe that is not the best, but yes I would like to
defer that discussion.  Having the string representation does allow 'pad()'
to make some checks on inputs to the built in functions.

About whether to have "pad('mean', a, 5)" or "pad(a, 'mean', 5)" - I don't
care.  It seems like we have two votes for the later form (Travis and
Nathaniel) and unless others weigh in, I will make the change soonish.

Kindest regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120402/457daca8/attachment.html 

More information about the NumPy-Discussion mailing list