On Mon, Dec 10, 2018 at 8:26 AM Alan Isaac <alan.is...@gmail.com> wrote:

> On 12/10/2018 11:20 AM, Ralf Gommers wrote:
> > there is nothing wrong with the current API
>
> Just to be clear: you completely reject the past
> cautions on this list against creating APIs
> with flag parameters.  Is that correct?
>
> Or is "nothing wrong" just a narrow approval in
> this particular case?


I agree with you that numpy.random.sample is redundant, that APIs based on
flags are generally poorly design and that all things being equal it would
be desirable for NumPy and Python's standard library to be aligned.

That said, "replacing a function/parameter with something totally different
by the same name" is a really painful/slow deprecation process that is best
avoided if at all possible in mature projects.

Personally, I would be +1 for issuing a deprecation warning for
np.random.sample, and removing it after a good amount of notice (maybe
several years). This is a similar deprecation cycle to what you see in
Python itself (e.g., for ABCs in collections vs collections.abc). If you
look at NumPy's docs for "Simple random data" [1] we have four different
names for this same function ("random_sample", "random", "ranf" and
"sample"), which is frankly absurd. Some cleanup is long overdue.

But we should be extremely hesitant to actually reuse these names for
something else. People depend on NumPy for stability, and there is plenty
of code written against NumPy from five years ago that still runs just fine
today. It's one thing to break code noisily by removing a function, but if
there's any chance of introducing silent errors that would be inexcusable.

Best,
Stephan

[1]
https://docs.scipy.org/doc/numpy-1.15.0/reference/routines.random.html#simple-random-data
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to