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

Christopher Jordan-Squire cjordan1@uw....
Fri Sep 2 13:45:05 CDT 2011


On Fri, Sep 2, 2011 at 12:58 PM, Nathaniel Smith <njs@pobox.com> wrote:
> On Fri, Sep 2, 2011 at 10:14 AM, Christopher Jordan-Squire
> <cjordan1@uw.edu> wrote:
>> I made the changes discussed here and pushed them to pull request.
>>
>> https://github.com/numpy/numpy/pull/143#issuecomment-1980897
>
> I think you mean https://github.com/numpy/numpy/pull/151
>

Yes. Sorry for the mix-up.

>> I changed the new function's name from sample to choice and added the
>> size=1 default as Robert suggested. I also reverted all the changes
>> for sample, random, and ranf and added them to the reference docs.
>
> I still think the default should be sampling without replacement, so
> as to reduce confusion later when we make this available as
> np.random.sample.
>

np.random.sample could be just a call to np.random.choice(blah, blah,
replace=False, blah). I'm not opposed to python compatibility, I just
would like a function with the defaults I want.

> You should also deprecate the current 'sample' alias (I believe this
> is basically a matter of documenting that it is deprecated, and making
> sure that it fires a deprecation warning when used). But perhaps you
> want to do that in a separate pull request, I dunno.
>

Yes, I think I need a separate pull request after getting some
agreement that it should be changed.

-Chris

> -- Nathaniel
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list