"is" vs "=="
-------------------------
- "is" expressions evaluate to True if two variables point to the same object.
- "==" evaluates to True if the objects referred to by the variables are equal.
>>> a = [1, 2, 3]>>> b = a >>> a is bTrue>>> a == bTrue >>> c = list(a) >>> a == cTrue>>> a is cFalse
Very informative blog!
ReplyDeletePlease take some time to visit my blog @
Python notes
Thanks!