Interning is re-using objects of equal value on-demand instead of creating new
objects. This is done for memory efficiency. Frequently used for numbers and
strings in different programming languages.
In the above code, 120 is intered by the Python interpreter but not 2000.
Python’s integer interning is done only for numbers in the range: [-5, 256]
Python interpreter also interns small strings.
Strings in python can be manually interned using sys.intern function.
Likewise, in the above code, only 1 integer object is created.