Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 26, 2020 00:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save IndhumathyChelliah/b42f5f938750f173e02530bba4f0abd7 to your computer and use it in GitHub Desktop.
x=[1,2,[3,4]]
#Copying x
y=copy(x)
#Both x[2] and y[2] (nested list in x and y) point to same list object in memory.
#both id are same
print (id(x[2]))#Output:17797480
print (id(y[2]))#Outpu:17797480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment