On Sun, Oct 12, 2014 at 11:33 AM, Warren Weckesser <warren.weckes...@gmail.com> wrote: > > > On Sun, Oct 12, 2014 at 11:20 AM, <josef.p...@gmail.com> wrote: >> >> On Sun, Oct 12, 2014 at 10:54 AM, Warren Weckesser >> <warren.weckes...@gmail.com> wrote: >> > >> > >> > On Sun, Oct 12, 2014 at 7:57 AM, Robert Kern <robert.k...@gmail.com> >> > wrote: >> >> >> >> On Sat, Oct 11, 2014 at 11:51 PM, Warren Weckesser >> >> <warren.weckes...@gmail.com> wrote: >> >> >> >> > 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. >> >> > >> >> > What do you think? >> >> >> >> It seems to me a perfectly good reason to have two methods instead of >> >> one. I can't imagine when I wouldn't be using a literal True or False >> >> for this, so it really should be two different methods. >> >> >> > >> > >> > I agree, and my first inclination was to propose a different method (and >> > I >> > had the bikeshedding conversation with myself about the name: >> > "disarrange", >> > "scramble", "disorder", "randomize", "ashuffle", some other variation of >> > the >> > word "shuffle", ...), but I figured the first thing folks would say is >> > "Why >> > not just add options to shuffle?" So, choose your battles and all that. >> > >> > What do other folks think of making a separate method? >> >> I'm not a fan of many similar functions. >> >> What's the difference between permute, shuffle and scramble? > > > > The difference between `shuffle` and the new method being proposed is > explained in the first email in this thread. > `np.random.permutation` with an array argument returns a shuffled copy of > the array; it does not modify its argument. (It should also get an `axis` > argument when `shuffle` gets an `axis` argument.) > > >> And how do I find or remember which is which? > > > > You could start with `doc(np.random)` (or `np.random?` in ipython).
If you have to check the docstring each time, then there is something wrong. In my opinion all docstrings should be read only once. It's like a Windows program where the GUI menus are not **self-explanatory**. What did Save-As do ? Josef > > Warren > > >> >> >> >> > >> > >> >> >> >> That said, I would just make the axis=None behavior the same for both >> >> methods. axis=None does *not* mean "treat this like a single >> >> monolithic blob" in any of the axis=-having methods; it means "flatten >> >> the array and do the operation on the single flattened axis". I think >> >> the latter behavior is a reasonable interpretation of axis=None for >> >> both methods. >> > >> > >> > >> > Sounds good to me. >> >> +1 (since all the arguments have been already given >> >> >> Josef >> - Why does sort treat columns independently instead of sorting rows? >> - because there is lexsort >> - Oh, lexsort, I haven thought about it in 5 years. It's not even next >> to sort in the pop up code completion >> >> >> > >> > Warren >> > >> > >> >> >> >> >> >> -- >> >> Robert Kern >> >> _______________________________________________ >> >> 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 >> > >> _______________________________________________ >> 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 > _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion