copy method for objects python code example
Example 1: python clone object
import copy
new_ob = copy.deepcopy(old_ob)
Example 2: python copy instance
import copy
class A(object):
def __init__(self, a)
self.a = a
a = A(38)
# Deepcopy
a2 = copy.deepcopy(a)
# Shallow copy -> use this if copy.deepcopy() fails
a3 = copy.copy(a)