Last active
January 18, 2020 22:00
-
-
Save edenau/bc98dceb5fb0e3bb7e7e25c15e11c63a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import copy | |
a = [[0,1],[2,3]] | |
b = copy.copy(a) | |
print(id(a)==id(b)) | |
# False | |
b[1] = 100 | |
print(a,b) | |
# [[0, 1], [2, 3]] [[0, 1], 100] | |
b[0][0] = -999 | |
print(a,b) | |
# [[-999, 1], [2, 3]] [[-999, 1], 100] | |
print(id(a[0]) == id(b[0])) | |
# True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment