[Numpy-discussion] New random.Generator method: permuted

Sebastian Berg sebastian at sipsolutions.net
Wed Aug 5 12:13:56 EDT 2020

On Mon, 2020-08-03 at 14:09 -0400, Warren Weckesser wrote:
> In one of the previous weekly zoom meetings, it was suggested
> to ping the mailing list about an updated PR that implements
> the `permuted` method for the Generator class in numpy.random.
> The relevant issue is
>     https://github.com/numpy/numpy/issues/5173
> and the PR is
>     https://github.com/numpy/numpy/pull/15121
> The new method (as it would be called from Python) is
>     permuted(x, axis=None, out=None)

I like the proposed API and name personally, and think we should go
ahead with it. It is a useful complement to `shuffle` (and sorting). 

The followup questions of adding `shuffled`, and what to do about
`permutation` are important, but I agree with viewing them as a second

This API has been discussed a few times in various depths, so I assume
that `permuted` as a name and API has largely settle down, and reached
consensus (at last if there is not more activity here or on the PR).

So, as a heads up, I am planning to review and push that forward in the
next days, but more discussion is of course welcome. We still have time
to decide differently.



> The CircleCI rendering of the docstring from the pull request is
> https://14745-908607-gh.circle-artifacts.com/0/doc/build/html/reference/random/generated/numpy.random.Generator.permuted.html
> The new method is an alternative to the existing `shuffle` and
> `permutation` methods.  It handles the `axis` parameter similar
> to how the sort methods do, i.e. when `axis` is given, the slices
> along the axis are shuffled independently.  This new documentation
> (added as part of the pull request) explains the API of the various
> related methods:
> https://14745-908607-gh.circle-artifacts.com/0/doc/build/html/reference/random/generator.html#permutations
> Additional feedback on the implementation of `permuted` in the
> pull request is welcome.  Further discussion of the API should
> be held in the issue gh-5173 (but please familiarize yourself
> with the discussion of the API in gh-5173--there has already
> been quite a long discussion of several different APIs).
> Thanks,
> Warren
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200805/7debe6a0/attachment.sig>

More information about the NumPy-Discussion mailing list