Created
August 23, 2011 23:41
-
-
Save capttwinky/1166931 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listA = [1,2,3,4] #listA now holds a refrence to a list object | |
listB = listA #a refrence to the refrence held by listA | |
listC = list(listA) #a new copy of the object reffered to in the refrence held by listA | |
listA.append('dog') #update the object reffered to in the refrence held by listA | |
print(listB) #a refrence to the refrence held by listA -> the object reffered to in the refrence held by listA | |
print(listC) #the copy we made before updating is, of course, unchanged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment