On Thu, Jul 12, 2018, 9:31 AM Serhiy Storchaka <storch...@gmail.com> wrote:

> 12.07.18 15:15, David Mertz пише:
> > On Thu, Jul 12, 2018, 7:56 AM Serhiy Storchaka
> I didn't mean any concrete implementation. Sure there are enough
> efficient and simple. I sometimes need a sequence of prime numbers for
> solving toy problems, and quickly write something like:
>
> def primes(n):
>      return (i for i in range(2, n) if all(i % j for j in
> primes(int(sqrt(i)) + 1)))
>
> Having such feature in the stdlib would be very convenient. Any
> reasonable implementation is enough efficient for my purposes.
>

That's the point I was getting at. "For your purposes" isn't general enough
to include in the standard library. There are quite a few algorithms and
efficiency trade-offs to decide on. It's not clear to me that any choice is
sufficiently "one size fits all" to include.

I'm not saying there definitely IS NOT a reasonable compromise approach to
these things, but I'd have to judge concrete suggestions... Or better
still, people with better knowledge of number theory than mine should make
those judgements.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to