On Mon, 13 Jul 2020 at 19:39, Christopher Barker <python...@gmail.com> wrote: > > On Mon, Jul 13, 2020 at 7:44 AM Guido van Rossum <gu...@python.org> wrote: >> >> I think you all should get together and come up with a good implementation, > > In any case, a good implementation would be a lot easier to evaluate for > inclusion. > >> Or maybe there is an existing open source 3rd party project that has code >> you can copy? I don’t recall if random has a C accelerator, but if it does, >> you should come up with C code as well.
I've already shown a second implementation that is plenty fast enough and pretty much optimal in a performance sense after following David's suggestion. It can possibly be improved by making a more reliable routine for geometric random variates which would also be a useful inclusion for the random module. I doubt it can be made any faster in the large iterable case using Cython/C though: it's already limited by the speed that islice can skip through items in the iterator and there's no way to avoid consuming the iterator in full. -- Oscar _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/4QQUT36IR7YA5GU2MNLRBKXERW2K36KM/ Code of Conduct: http://python.org/psf/codeofconduct/