["python"]
Compare if two variables reference the same object in python

How to check whether two variables reference the same object? x = ['a', 'b', 'c'] y = x # x and y reference the same object z = ['a', 'b', 'c'] # x and z reference different objects
That’s what is is for. In the example, x is y returns True because it is the same object while x is z returns False because it are different objects (which happen to hold identical data).