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

Tim Cera tim at cerazone.net
Mon Apr 2 12:36:21 EDT 2012


On Mon, Apr 2, 2012 at 12:09 PM, Travis Oliphant <travis at 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
argument.

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

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,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120402/457daca8/attachment.html>


More information about the NumPy-Discussion mailing list