I expect deepcopy to duplicate my object and return a different object id each time it is called since MyClass is mutable, but it does not. Each time the function f() is called, deepcopy returns the same id. I don't know what am I missing here. Here is the code:
from copy import deepcopy
class MyClass:
def __init__(self):
self.x = 0
obj1 = MyClass()
def f():
obj_c = deepcopy(obj1)
print id(obj_c)
# each call prints same id
f()
f()