0

I'm trying to understand how Python 2.7.6 can output -4294967296 from a 32 bit integer. My assumptions on python integers are:

  1. Python does not have unsigned integers
  2. Python uses 2's complement

If assumption 2 is true than in a 32 bit integer the max negative number should be -2147483648 (-2^31) since the MSB is resolved for the sign of the integer.

Does Python stack on another 32 bits ( 32 bit + 32 bit) to make a 64 bit integer?

tyleax
  • 1,556
  • 2
  • 17
  • 45

1 Answers1

1

Python does not have a limit for the size on an integer.

In Python 2, integers would automatically be converted to longs when they went past the limit for an INT.

In Python 3, Integers have arbitrarily high precision.There is no defined limit in the language.

user2782067
  • 382
  • 4
  • 19