0
Help me please!
Why "is" evaluates to True in the first case and to False in the second? First case: a = 247 b = 247 print((a is b) == (a == b)) >>> True Second case: a =[2,3,4] b =[2,3,4] print(a is b) >>> False Also please let me know where can I found more on this "is". Thanks in advance!
2 Antworten
+ 3
The "is" operator checks if 2 values refer to the same object, while == checks if their values are equal. When comparing object, it returns false even if they have the same values. It only returns true if you specifically assign it go
0
Airree thanks! In the meantime I found this topic: https://stackoverflow.com/questions/132988/is-there-a-difference-between-and-is
I feel more confortable now.