Oct-21-2019, 08:37 PM
The current implementation keeps an array of integer objects for all integers between -5 and 256, when you create an int in that range you actually just get back a reference to the existing object.
x = 5005 y = 5005 print(id(x),id(y))Considering the text above I should get different addresses but to my surprise, I get the same address. Multiple people also tried the code above and got the same address, what is the cause of this? Would appreciate if it was explained in depth, thanks!