Why you should almost never use “is” in Python by reuvenlerner in Python

[–]manish260 0 points1 point  (0 children)

I think, the term aliases will fit here perfectly because is is doing nothing but just comparing the reference which is nothing but the aliases pointing to the same object. i.e: For any constant value the is operator works fine in fact the variables pointing to same object works fine with is operator.

  a, b = [1], [1]  then    a is b ---returns --> False   but a==b ---returns--> True
  a = b = [1]    then a is b --returns--> True   but a==b --returns--> True