numpy/numpy — pull request #2992 by seberg (2013-02-15 21:40:53+00:00)
Title: BUG: fix random.choice scalar object result and disallow 0-d arrays

Object arrays failed due to bad check for finding out if the result should
be a scalar type and not an array when size=None. Also in this case the
creation of the new array was wrong. This should be fixed with this.

The second fix is to forbid 0-d arrays. Allowing 0-d arrays does not
make much sense. But it is dangerous because for example floats will
be interpreted as 1-d arrays, while one may expect that they are interpreted
as integers. This also saves the trouble of reliably detecting all integers...

--

Fixes a bug reported on the mailing list, and attempts to make that integer stuff sane. I am a bit unsure if that was a good idea in the first place and not just thing stolen from R without thinking about it.

This needs to be backported into 1.7.