[Numpy-discussion] Request for enhancement to numpy.random.shuffle
njs at pobox.com
Thu Oct 16 12:40:27 EDT 2014
On Thu, Oct 16, 2014 at 4:39 PM, Warren Weckesser
<warren.weckesser at gmail.com> wrote:
> On Sun, Oct 12, 2014 at 9:13 PM, Nathaniel Smith <njs at pobox.com> wrote:
>> Regarding names: shuffle/permutation is a terrible naming convention
>> IMHO and shouldn't be propagated further. We already have a good
>> naming convention for inplace-vs-sorted: sort vs. sorted, reverse vs.
>> reversed, etc.
>> So, how about:
>> scramble + scrambled shuffle individual entries within each
>> row/column/..., as in Warren's suggestion.
>> shuffle + shuffled to do what shuffle, permutation do now (mnemonic:
>> these break a 2d array into a bunch of 1d "cards", and then shuffle
>> those cards).
>> permuted remains indefinitely, with the docstring: "Deprecated alias
>> for 'shuffled'."
> That sounds good to me. (I might go with 'randomize' instead of 'scramble',
> but that's a second-order decision for the API.)
I hesitate to use names like "randomize" because they're less
informative than they feel seem -- if asked what this operation does
to an array, then it would be natural to say "it randomizes the
array". But if told that the random module has a function called
randomize, then that's not very informative -- everything in random
randomizes something somehow.
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
More information about the NumPy-Discussion