import pickle
class A(object):
def __init__(self, val):
self.val = val
a = A(1)
a_copy = pickle.loads(pickle.dumps(a))
print("a val = ", a.val)
print("a_copy val = ", a_copy.val)
a.val = 10
print("a val = ", a.val)
print("a_copy val = ", a_copy.val)
a_copy.val = 25
print("a val = ", a.val)
print("a_copy val = ", a_copy.val)
aW1wb3J0IHBpY2tsZQoKY2xhc3MgQShvYmplY3QpOgoJZGVmIF9faW5pdF9fKHNlbGYsIHZhbCk6CgkJc2VsZi52YWwgPSB2YWwKCmEgPSBBKDEpCmFfY29weSA9IHBpY2tsZS5sb2FkcyhwaWNrbGUuZHVtcHMoYSkpCgpwcmludCgiYSB2YWwgPSAiLCBhLnZhbCkKcHJpbnQoImFfY29weSB2YWwgPSAiLCBhX2NvcHkudmFsKQoKYS52YWwgPSAxMApwcmludCgiYSB2YWwgPSAiLCBhLnZhbCkKcHJpbnQoImFfY29weSB2YWwgPSAiLCBhX2NvcHkudmFsKQoKYV9jb3B5LnZhbCA9IDI1CnByaW50KCJhIHZhbCA9ICIsIGEudmFsKQpwcmludCgiYV9jb3B5IHZhbCA9ICIsIGFfY29weS52YWwpCg==