Professional Documents
Culture Documents
NYU CS 1134 Copy Notes
NYU CS 1134 Copy Notes
Construction
● stores the copy of the original object and points the references to the objects
● lst.copy()
● + operator
● * operator
● by default, most python operations are shallow copy (default copy.copy is shallow)
● stores the copy of the original object and recursively copies the objects as well
When copying a compound object, like a list or dictionary, shallow copy makes a copy of the
compound object and makes references to the objects in the compound object. Deep copy makes
a copy of the compound object and all the objects in the compound object.