+ 7
== checks for the same value, is checks for identity. a = [1, 2, 3] b = [1, 2, 3] c = a a and b are two separate lists, but have the same value, so a == b but not a is b. c is just another name for a, so a==c (same value) but in this case also a is c, because it is the very object. You can look up the id of any object with the function id(). If an object 'is' another object, it has the same id. (And 'another object' is paradox, because if a is b, it is not another object, but actually that object. ;))
5th Apr 2019, 9:58 PM
HonFu
HonFu - avatar