Today I am going to explain a scenario to differentiate is and == operators.
I've got a python program as follows,
This is because,
is is identity testing, == is equality testing. what happens in your code would be emulated in the interpreter like this:
so, no wonder they're not the same, right?
In other words: is is the id(a) == id(b)
So, when the char set exceeds 256, a new id is assigned and that's why identity check fails for the above case.
Written by Vivek Soundrapandi
Published Date: {{ article.pub_date }}
View all posts by: Vivek Soundrapandi