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

Sebastian Berg sebastian@sipsolutions....
Mon Nov 12 19:18:41 CST 2012


On Mon, 2012-11-12 at 18:36 -0500, Alan G Isaac wrote:
> On 11/12/2012 5:46 PM, Nathaniel Smith wrote:
> > Want to make a pull request?
> 
> 
> Well, I'd be happy to help Sebastien to change the
> code, but I'm not a git user.
> 

I have created a pull request, but tests are still needed... If you like
it would be very nice if you can check it and maybe also write some
tests. Git is relatively simple (and likely worth to learn) but even
otherwise posting code would be nice.

> And I'd have some questions.  E.g., with `size=None`,
> couldn't we just call Python's random.choice?  And for
> sampling without replacement, wouldn't it be faster to
> just call Python's random.sample (rather than
> implement this as currently done)?
> 

I don't think the difference should be really noticeable. But even if, I
doubt its worth special casing. If someone cares a lot about speed they
probably should not use it to get single values anyway. Also for this
case of random numbers, it would be a bad idea since you would use a
different random number generator and a different seed!

Regards,

Sebastian

> 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