[Python-ideas] Add the imath module
David Mertz
mertz at gnosis.cx
Thu Jul 12 13:26:45 EDT 2018
On Thu, Jul 12, 2018, 9:31 AM Serhiy Storchaka <storchaka at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180712/9be89f4c/attachment.html>
More information about the Python-ideas
mailing list