<div dir="ltr">OK. I know I made a mistake by saying, "computers are very good at *exhaustively* searching multidimensional spaces." I should have said, "computers are very good at enumerating examples from multi-dimensional spaces" or something to that effect. Now that we've had our fun, can you guys please continue in a forked conversation so it doesn't derail the conversation?<br></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Nov 28, 2018 at 7:47 PM David Mertz <<a href="mailto:mertz@gnosis.cx">mertz@gnosis.cx</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I was assuming it was a Numba-ized function since it's purely numeric. ;-)</div><div dir="auto"><br></div><div dir="auto">FWIW, the theoretical limit of Python ints is limited by the fact 'int.bit_length()' is a platform native int. So my system cannot store ints larger than (2**(2**63-1)). It'll take a lot more memory than my measly 4GiB to store that number though.</div><div dir="auto"><br></div><div dir="auto">So yes, that's way longer that heat-death-of-universe even before 128-bit machines are widespread.<br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Wed, Nov 28, 2018, 6:43 PM Antoine Pitrou <<a href="mailto:antoine@python.org" target="_blank">antoine@python.org</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
But Python integers are variable-sized, and their size is basically<br>
limited by available memory or address space.<br>
<br>
Let's take a typical 64-bit Python build, assuming 4 GB RAM available.<br>
Let's also assume that 90% of those 4 GB can be readily allocated for<br>
Python objects (there's overhead, etc.).<br>
<br>
Also let's take a look at the Python integer representation:<br>
<br>
>>> sys.int_info<br>
sys.int_info(bits_per_digit=30, sizeof_digit=4)<br>
<br>
This means that every 4 bytes of integer object store 30 bit of actual<br>
integer data.<br>
<br>
So, how many bits has the largest allocatable integer on that system,<br>
assuming 90% of 4 GB are available for allocation?<br>
<br>
>>> nbits = (2**32)*0.9*30/4<br>
>>> nbits<br>
28991029248.0<br>
<br>
Now how many possible integers are there in that number of bits?<br>
<br>
>>> x = 1 << int(nbits)<br>
>>> x.bit_length()<br>
28991029249<br>
<br>
(yes, that number was successfully allocated in full.  And the Python<br>
process occupies 3.7 GB RAM at that point, which validates the estimate.)<br>
<br>
Let's try to have a readable approximation of that number.  Convert it<br>
to a float perhaps?<br>
<br>
>>> float(x)<br>
Traceback (most recent call last):<br>
  File "<stdin>", line 1, in <module><br>
OverflowError: int too large to convert to float<br>
<br>
Well, of course.  So let's just extract a power of 10:<br>
<br>
>>> math.log10(x)<br>
8727169408.819794<br>
>>> 10**0.819794<br>
6.603801339268099<br>
<br>
(yes, math.log10() works on non-float-convertible integers.  I'm impressed!)<br>
<br>
So the number of representable integers on that system is approximately<br>
6.6e8727169408.  Let's hope the Sun takes its time.<br>
<br>
(and of course, what is true for ints is true for any variable-sized<br>
input, such as strings, lists, dicts, sets, etc.)<br>
<br>
Regards<br>
<br>
Antoine.<br>
<br>
<br>
Le 29/11/2018 à 00:24, David Mertz a écrit :<br>
> That's easy, Antoine. On a reasonable modern multi-core workstation, I<br>
> can do 4 billion additions per second. A year is just over 30 million<br>
> seconds. For 32-bit ints, I can whiz through the task in only 130,000<br>
> years. We have at least several hundred million years before the sun<br>
> engulfs us.<br>
> <br>
> On Wed, Nov 28, 2018, 5:09 PM Antoine Pitrou <<a href="mailto:solipsis@pitrou.net" rel="noreferrer" target="_blank">solipsis@pitrou.net</a><br>
> <mailto:<a href="mailto:solipsis@pitrou.net" rel="noreferrer" target="_blank">solipsis@pitrou.net</a>> wrote:<br>
> <br>
>     On Wed, 28 Nov 2018 15:58:24 -0600<br>
>     Abe Dillon <<a href="mailto:abedillon@gmail.com" rel="noreferrer" target="_blank">abedillon@gmail.com</a> <mailto:<a href="mailto:abedillon@gmail.com" rel="noreferrer" target="_blank">abedillon@gmail.com</a>>> wrote:<br>
>     > Thirdly, Computers are very good at exhaustively searching<br>
>     multidimensional<br>
>     > spaces.<br>
> <br>
>     How long do you think it will take your computer to exhaustively search<br>
>     the space of possible input values to a 2-integer addition function?<br>
> <br>
>     Do you think it can finish before the Earth gets engulfed by the Sun?<br>
> <br>
>     Regards<br>
> <br>
>     Antoine.<br>
> <br>
> <br>
>     _______________________________________________<br>
>     Python-ideas mailing list<br>
>     <a href="mailto:Python-ideas@python.org" rel="noreferrer" target="_blank">Python-ideas@python.org</a> <mailto:<a href="mailto:Python-ideas@python.org" rel="noreferrer" target="_blank">Python-ideas@python.org</a>><br>
>     <a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
>     Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
> <br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" rel="noreferrer" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div></div></div>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div>