I was reading from the book How to Think Like A Computer Scientist: Learning with Python when I came across the following question:
As an exercise, describe the relationship between string.join(string.split(song)) and song. Are they the same for all strings? When would they be different? (song had been defined as "The rain in Spain...")
After checking it out, however, I found that both are different strings. I tried using string.join(string.split(song)) is song
and f is song
where f had been assigned the value string.join(string.split(song)) and both evaluated to False
. Why is it so?