[Python-Dev] Cannot declare the largest integer literal.
Tue, 2 May 2000 22:20:20 -0400
> >>> i = -2147483648
> OverflowError: integer literal too large
> >>> i = -2147483648L
> >>> int(i) # it *is* a valid integer literal
Python's grammar is such that negative integer literals don't exist; what
you actually have there is the unary minus operator applied to positive
integer literals; indeed,
>>> def f():
>>> import dis
0 SET_LINENO 1
3 SET_LINENO 2
6 LOAD_CONST 1 (42)
11 LOAD_CONST 0 (None)
Note that, at runtime, the example loads +42, then negates it: this wart
has deep roots!
> And was the effect on functions like PyOS_strtol() down the pipe
More that it was considered an inconsequential endcase. It's sure not worth
changing the grammar for <wink>. I'd rather see Python erase the visible
distinction between ints and longs.