compare(a, b) that returns "same object" if a is b, "equal but different" if a == b but a is not b, and "different" if neither holds. This tests the distinction between is (identity) and == (value equality).x = [1, 2]; compare(x, x)
'same object'
x and x reference the exact same list.
compare([1, 2], [1, 2])
'equal but different'
Equal values, distinct list objects.
Order the checks: is, then ==.
Two separately created lists are never the same object even with equal contents.