[Numpy-discussion] fix random.choice for 1.7?

Nathaniel Smith njs@pobox....
Mon Nov 12 10:52:24 CST 2012


On Mon, Nov 12, 2012 at 5:31 PM, Alan G Isaac <alan.isaac@gmail.com> wrote:
> In a comment on the issue https://github.com/numpy/numpy/issues/2724 Sebastian notes:
> "it could also be reasonable to have size=None as default and have it return a scalar/the given axes removed in that case. That would be a real change
> in functionality unfortunately, but it would make sense for similarity to import random; random.choice mostly."
>
> If this is under serious consider, then perhaps
> random.choice should not be in 1.7 unless a decision can
> be quickly made about the default for `size`.
> (Allowing an axis argument can however be postponed.)
>
> I am inclined to think that Sebastian's suggestion
> is correct.

For anyone else trying to follow, here's the current function:
  http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.random.choice.html

I'm afraid I don't understand what Sebastian is suggesting should
happen by default. size=None doesn't have any intuitive meaning to me,
and I don't know what "a scalar/the given axes removed" means.

-n


More information about the NumPy-Discussion mailing list