Create a copy class method for a Python object containing a Swig object
问题 I have created a Python class with an attribute that is a Swig object (which happens to be a wrapper of a C structure). I want to be able to create copies of that class, e.g., by defining a __copy__ method, that contain independent copies of the Swig object (using the copy modules' copy class just creates a pointer to the original object, and deepcopy fails). Does anyone know if you can just copy chunks of memory in Python, and use this to copy the attribute containing the Swig object? Or,