Code review comment for ~smoser/cloud-init:bug/1621180

Revision history for this message
Scott Moser (smoser) wrote :

$ python ./mytest.py
before deepcopy
f1 is f: True
f1 == f: True
after deepcopy
f1 is f: False
f1 == f: True

$ cat mytest.py
#!/usr/bin/python

import copy

f = {'a': {'b': {'c': {1}}}}
f1 = f

print("before deepcopy")
print("f1 is f: %s" % (f1 is f))
print("f1 == f: %s" % (f1 == f))

f = copy.deepcopy(f)

print("after deepcopy")
print("f1 is f: %s" % (f1 is f))
print("f1 == f: %s" % (f1 == f))

« Back to merge proposal