[Numpy-discussion] Adding a return value to np.random.shuffle

Eric Wieser wieser.eric+numpy at gmail.com
Thu Apr 12 13:52:51 EDT 2018


I’m against this change, because it:

   - Is inconsistent with the builtin random.shuffle
   - Makes it easy to fall into the trap of assuming that np.random.shuffle
   does not mutate it’s input

Eric
​

On Thu, 12 Apr 2018 at 10:37 Joseph Fox-Rabinovitz <jfoxrabinovitz at gmail.com>
wrote:

> Would it break backwards compatibility to add the input as a return value
> to np.random.shuffle? I doubt anyone out there is relying on the None
> return value.
>
> The change is trivial, and allows shuffling a new array in one line
> instead of two:
>
>     x = np.random.shuffle(np.array(some_junk))
>
> I've implemented the change in PR#10893.
>
> Regards,
>
> - Joe
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180412/b0a6da96/attachment.html>


More information about the NumPy-Discussion mailing list