Integer Overflow
Tim Peters
tim at zope.com
Tue Nov 27 14:59:31 EST 2001
[Skip Montanaro]
> In the current 2.2 beta, int operations that would overflow
> silently return longs:
>
> >>> 3**100
> 515377520732011331036461129765621272702107522001L
[Fernando Perez]
> Just curious: how bad is the performance impact from this (if any)?
Python was always checking for overflow, so a non-overflowing case is as
quick as before. The new expense when it does overflow is subtle: you can
still get optional warnings about overflows in 2.2, so an overflow takes an
expensive trip through the warning-suppression machinery to see whether or
not you want a warning. I expect that option will go away in 2.3.
More information about the Python-list
mailing list