Object Interning In Python

Introduction

Object Interning is nothing but the two different variables having the same value is stored in the same address.

In python,

  • type() is used to identify the type of the variable.
  • id() is used to identify the address of the variable.

If there are two variables a and b with different values 10 and 20, then both the values are stored in different address locations.

If there are two variables a and b with the same value of 10, then both the values are stored in the same address location.

Summary

Two different variables with the same value are stored in the same address location is called Object Interning.