Interned Literals vs Runtime Strings
s1 = "hello"
s2 = "hello"
print(s1 is s2)
parts = ["hel", "lo"]
more_parts = ["hel", "lo"]
s3 = "".join(parts)
s4 = "".join(more_parts)
print(s3 is s4)
s3 and s4 both end up equal to "hello". What does this print, under CPython 3.14?
Sign in to answer questions and track your progress
Sign In