<div dir="ltr"><div>Thanks Warren, I think these are sensible additions.<br><br>I would argue to treat the None-False condition as an error. Indeed I agree one might argue the correcr behavior is to 'shuffle' the singleton block of data, which does nothing; but its more likely to come up as an unintended error than as a natural outcome of parametrized behavior.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 12, 2014 at 3:31 AM, John Zwinck <span dir="ltr"><<a href="mailto:jzwinck@gmail.com" target="_blank">jzwinck@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Sun, Oct 12, 2014 at 6:51 AM, Warren Weckesser<br>
<<a href="mailto:warren.weckesser@gmail.com">warren.weckesser@gmail.com</a>> wrote:<br>
> I created an issue on github for an enhancement<br>
> to numpy.random.shuffle:<br>
>     <a href="https://github.com/numpy/numpy/issues/5173" target="_blank">https://github.com/numpy/numpy/issues/5173</a><br>
<br>
</span>I like this idea.  I was a bit surprised there wasn't something like<br>
this already.<br>
<span><br>
> A small wart in this API is the meaning of<br>
><br>
>   shuffle(a, independent=False, axis=None)<br>
><br>
> It could be argued that the correct behavior is to leave the<br>
> array unchanged. (The current behavior can be interpreted as<br>
> shuffling a 1-d sequence of monolithic blobs; the axis argument<br>
> specifies which axis of the array corresponds to the<br>
> sequence index.  Then `axis=None` means the argument is<br>
> a single monolithic blob, so there is nothing to shuffle.)<br>
> Or an error could be raised.<br>
<br>
</span>Let's think about it from the other direction: if a user wants to<br>
shuffle all the elements as if it were 1-d, as you point out they<br>
could do this:<br>
<br>
  shuffle(a, axis=None, independent=True)<br>
<br>
But that's a lot of typing.  Maybe we should just let this do the same thing:<br>
<br>
  shuffle(a, axis=None)<br>
<br>
That seems to be in keeping with the other APIs taking axis as you<br>
mentioned.  To me, "independent" has no relevance when the array is<br>
1-d, it can simply be ignored.<br>
<span class="HOEnZb"><font color="#888888"><br>
John Zwinck<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</font></span></blockquote></div><br></div>