[Numpy-discussion] Changed behavior of np.gradient

Nathaniel Smith njs at pobox.com
Tue Oct 14 12:57:01 EDT 2014


On 4 Oct 2014 22:17, "Stéfan van der Walt" <stefan at sun.ac.za> wrote:
>
> On Oct 4, 2014 10:14 PM, "Derek Homeier" <
derek at astro.physik.uni-goettingen.de> wrote:
> >
> > +1 for an order=2 or maxorder=2 flag
>
> If you parameterize that flag, users will want to change its value (above
two). Perhaps rather use a boolean flag such as "second_order" or
"high_order", unless it seems feasible to include additional orders in the
future.

Predicting the future is hard :-). And in particular high_order= would
create all kinds of confusion if in the future we added 3rd order
approximations but high_order=True continued to mean 2nd order because of
compatibility. I like maxorder (or max_order would be more pep8ish I guess)
because it leaves our options open. (Similar to how it's often better to
have a kwarg that can take two possible string values than to have a
boolean kwarg. It makes current code more explicit and makes future
enhancements easier.)

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141014/ff2d6fec/attachment.html>


More information about the NumPy-Discussion mailing list