https://habrahabr.ru/post/193890/ This page describes how the int type is arranged in python2. However, as I understand it, in python3 it is arranged differently - instead of 24 bytes it takes 28 and contains 4 numbers, not 3. But I did not understand what these numbers mean to him.
1 answer
Everything, I figured it out. An int is stored as follows: the first number of the long type is the number of references to an object; the second is the id of the object type, then the actual number stored in several int numbers, and the third number before them is the actual number of these numbers. Thank you very much @insolor and @jfs for your help.
|
intin Python is unlimited (therefore, you will not get by with 4 numbers). If you are interested in how CPython implements this, you can look at the typePyLongObject- jfs