Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
deepcopy vs list
import copy
a = 1
b = [1,2,3]
c = "Some random string :)"
z = [a,b,c]
x = list(z)
x[1][1] = 100
print x
print z
@rhtyd

This comment has been minimized.

Copy link
Owner Author

rhtyd commented Jul 14, 2015

Why list() is wrong, because x == z

In [37]: print x
[1, [1, 100, 3], 'Some random string :)']

In [38]: print z
[1, [1, 100, 3], 'Some random string :)']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.