Thanks Warren, I think these are sensible additions.

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.

On Sun, Oct 12, 2014 at 3:31 AM, John Zwinck <jzwi...@gmail.com> wrote:

> On Sun, Oct 12, 2014 at 6:51 AM, Warren Weckesser
> <warren.weckes...@gmail.com> wrote:
> > I created an issue on github for an enhancement
> > to numpy.random.shuffle:
> >     https://github.com/numpy/numpy/issues/5173
>
> I like this idea.  I was a bit surprised there wasn't something like
> this already.
>
> > A small wart in this API is the meaning of
> >
> >   shuffle(a, independent=False, axis=None)
> >
> > It could be argued that the correct behavior is to leave the
> > array unchanged. (The current behavior can be interpreted as
> > shuffling a 1-d sequence of monolithic blobs; the axis argument
> > specifies which axis of the array corresponds to the
> > sequence index.  Then `axis=None` means the argument is
> > a single monolithic blob, so there is nothing to shuffle.)
> > Or an error could be raised.
>
> Let's think about it from the other direction: if a user wants to
> shuffle all the elements as if it were 1-d, as you point out they
> could do this:
>
>   shuffle(a, axis=None, independent=True)
>
> But that's a lot of typing.  Maybe we should just let this do the same
> thing:
>
>   shuffle(a, axis=None)
>
> That seems to be in keeping with the other APIs taking axis as you
> mentioned.  To me, "independent" has no relevance when the array is
> 1-d, it can simply be ignored.
>
> John Zwinck
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to