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

Sebastian Berg sebastian@sipsolutions....
Mon Nov 12 07:59:42 CST 2012


Hey,

On Mon, 2012-11-12 at 08:48 -0500, Alan G Isaac wrote:
> On 11/9/2012 12:21 PM, Nathaniel Smith wrote:
> > you might want to double-check that the
> > np.random.choice in 1.7 actually*does*  give an error if the input
> > array is not 1-d
> 
> 
> Any idea where I can look at the code?
> I browsed github after failing to find
> a productive search string, but failed
> to find it.
> 

its here:
https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/mtrand.pyx#L919

Sounds like it should be pretty simple to add axis=None which would
change the current behavior very little, it would stop give an error
anymore for none 1-d arrays though.

Regards,

Sebastian


> Which remind me: it would be nice if the
> docs linked to the source.
> 
> Thanks,
> Alan
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 




More information about the NumPy-Discussion mailing list