I know I know..., this was asked a ton of time, but since I have JavaScript background I cannot get my head around what the heck is going on when we use the is
to compare primitives in python
The is
comparison operator is used to check if variables points to the same memory location (pretty clear huh? we should use it to check object identity), but I see a lot of <something> is not None
code around and I just don't get it :/
So what's the difference between abc
VS ''.join(['a', 'b', 'c'])
in regards of the is
operator
a = 'abc'
b = 'abc'
print( a == b) # True
print( a is b) # True
x = 'abc'
y = ''.join(['a', 'b', 'c'])
print( x == y ) # True
print( x is y ) # False