擅长:python、mysql、java
<p>好消息是:Python中的整数数学很简单,没有溢出。在</p>
<p>只要您的整数可以放入C<code>long</code>,Python就会使用它。一旦你超过了这一点,它将自动升级为任意精度的整数(这意味着它将更慢,占用更多内存,但计算将保持正确)。在</p>
<p>唯一的限制是:</p>
<ol>
<li><p>Python进程可寻址的内存量。如果您使用的是32位Python,那么您需要能够将所有数据放在2GB或RAM内(超过这个值,您的程序将失败,<code>MemoryError</code>)。如果您使用64位Python,那么您的物理RAM+swapfile是理论上的限制。</p></li>
<li><p>在计算过程中你愿意等待的时间。整数越大,计算就越慢。如果你碰到你的交换空间,你的程序将达到大陆漂移水平的缓慢。</p></li>
</ol>