[Numpy-discussion] Pull Request Review: R-like sample function

Christopher Jordan-Squire cjordan1 at uw.edu
Thu Sep 1 23:07:47 EDT 2011


On Thu, Sep 1, 2011 at 10:48 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On Thu, Sep 1, 2011 at 21:39, Christopher Jordan-Squire <cjordan1 at uw.edu> wrote:
>> On Thu, Sep 1, 2011 at 10:01 PM,  <josef.pktd at gmail.com> wrote:
>
>>> First these functions would need to be deprecated.
>>
>> I discussed this with a few other people, and they suggested that it
>> could be alright since it's for numpy 2.0 rather than numpy 1.x. For
>> the 2.0 version it would be perfectly reasonable to have a break with
>> the API. (Though, as I said, it's not a break with the API.)
>
> Yes it is. A very long-standing API. The fact that you had to go
> remove a number of actual uses of the aliases should have told you
> this. The documentation is not the API. You cannot remove these
> aliases without a deprecation period lasting one full minor release.
> 2.0 is not license to make backwards-incompatible changes solely for
> aesthetic reasons. There is no reason not to follow the standard
> deprecation schedule here.
>

Then I was misinformed, and I hadn't realized it was a long-standing use.

I suspected it might be problematic for np.random.random. But
np.random.sample was only used once, and np.random.ranf not at all.
Those two didn't appear in the statsmodels code base either, I don't
think. (And random.random only appeared once in a docstring.)

So in the mean time, are there any suggestions for what this R sample
function should be called, since random.sample is apparently taken?

-Chris

>> I can't think of many other instances of aliased functions like that
>> in numpy, though--but perhaps I'm not thinking hard enough. It
>> certainly seemed strange to have 4 names for the same function.
>
> numpy.random was actually replacing multiple libraries at once. The
> aliases kind of accreted.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>   -- Umberto Eco
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list