[Python-Dev] Cannot declare the largest integer literal.

Mark Hammond mhammond@skippinet.com.au
Wed, 3 May 2000 09:12:18 +1000


> >>> i = -2147483648
> OverflowError: integer literal too large
> >>> i = -2147483648L
> >>> int(i)   # it *is* a valid integer literal
> -2147483648

I struck this years ago!  At the time, the answer was "yes, its an
implementation flaw thats not worth fixing".

Interestingly, it _does_ work as a hex literal:

>>> 0x80000000
-2147483648
>>> -2147483648
Traceback (OverflowError: integer literal too large
>>>

Mark.