# Mutable object
l = [1, 2, 3]
print(f"Address of l is {id(l)}")
l += [4]
print(f"Address of l is {id(l)}")
# Immutable object
s = 'abc'
print(f"Address of s is {id(s)}")
s += 'd'
print(f"Address of s is {id(s)}")
# Output:
Address of l is 1621540708864
Address of l is 1621540708864
Address of s is 1621541747712
Address of s is 1621542153616
댓글 영역