My understanding is that the "is" keyword checks that two objects are in fact the same object.
str types are immutable and can be compared using "is" as (I'm assuming) they are always represented by the same underlying object. e.g.
"abc" is "abc" # True
a = "abc"; a == "abc" # True
lst = ["abc", 1, 2]; lst[0] is "abc" # True
However (arbitrary examples I know), If i did something like this:
string_a = "abc_123"
string_b = re.search("abc", string_a).group() # gets "abc"
cls = type(string_b). # Says its a str type
string_b == "abc" # Returns True & Shows me that it is "abc"
string_b is "abc" # Returns False.
Why does the last line return False when string_b is of type str and equals "abc"?