1

I try to write a custom deepcopy that first calls the default implementation, and then does something extra

That is, something like this :

class Foo(object):
    def __deepcopy__(self, memo):
        cp = super(Foo, self).__deepcopy__(memo)
        # custom treatments
        return cp

However when I call deepcopy(Foo()), I get the following error :

AttributeError: 'super' object has no attribute 'deepcopy'

How could I call the default deepcopy from here ?

Eino Gourdin
  • 4,169
  • 3
  • 39
  • 67

0 Answers0