Just started with Python (2.0, if that matters), and this is purely for the sake of curiosity, but I was wondering exactly what was going behind the scenes in the following scenario using "==" and "is":
a = 'cats'
a == 'cats'
True
a is 'cats'
True
a = 'cats!'
a == 'cats!'
True
a is 'cats!'
False
Somehow, the inclusion of punctuation is preventing a match by identity using is (which makes sense, since it's a string and not an integer value), but why does the first example ('cats' with no !) evaluate to true?
I thought I had a handle on the difference between "==" and "is" and what it meant to check equality and identity, but this making me question, well... everything.