in Lists
-
I can always check that b=a
points to same object and c=a[:]
creates another copy.
>>> a = [1,2,3,4,5]
>>> b = a
>>> c = a[:]
>>> a[0] = 10
>>> b
[10, 2, 3, 4, 5]
>>> c
[1, 2, 3, 4, 5]
In Strings
-
I cannot make a change to the original immutable string. How do I confirm myself that b=a
makes b
point to same object, while c = a[:]
creates a new copy of the string?