hex to signed integer
Steven Taschuk
staschuk at telusplanet.net
Thu Jul 17 20:05:22 EDT 2003
Quoth Bengt Richter:
[...]
> >>> -2**31
> -2147483648L
> Oops, is that a wart/buglet BTW?
That it's a long and not an int? Certainly not a bug, arguably a
wart, and in any case it's 2's-complement's fault, not Python's:
-2**31 is equivalent to -(2**31), and the inner expression doesn't
fit into an int (on suitable machines).
I suppose long arithmetic could produce ints when possible, but it
seems unlikely to be worth the trouble.
--
Steven Taschuk "The world will end if you get this wrong."
staschuk at telusplanet.net -- "Typesetting Mathematics -- User's Guide",
Brian Kernighan and Lorrinda Cherry
More information about the Python-list
mailing list