Copy constructor in python?

I think you want the copy module

import copy

x = copy.copy(y)        # make a shallow copy of y
x = copy.deepcopy(y)    # make a deep copy of y

you can control copying in much the same way as you control pickle.

Leave a Comment