Re:Facts and myths about Python names and values
by wahnfrieden on Sunday July 14, 2013 @04:40PM
(#6042155)
To get more specific, this object aliasing is an implementation detail. You can't expect different Python implementations to do it the same.
'is' actually checks memory locations and not equity.
Because of the way Python caches small integers, anything from 0 through X will map to the same memory location. But a large integer (say 1001) will map to a new memory location each time its created.