I checked maximum size of the integer Python holds using sys.maxsize and it returned me 9223372036854775807.
Then why I can still store a value greater than this range?
How many bytes are required to store an integer and do Python changes number of bytes depending on the size of an integer?
I am using Python 3.6
2^63 - 1is along, and will be represented with a trailingL:9223372036854775808L.sys.maxsizeis not the maximum size of anint. It is the maximum size of a machine word, so, on your 64bit system, that is2**63 - 1. This many bytes is fundamentally how much memory can be allocated. Note, this is why, on 32-bit versions of Python, you cannot allocate more than 4 gigs of ram, no matter how much your hardware supports. This is because the maximum addressable size is2**32 - 1 == 4294967295. It just happens that in Python 2, theinttype uses a machine-word's size, but one could have used 128 bits...maxint, the duplicate seems right