[Tutor] copying

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Mon, 21 Aug 2000 18:29:43 -0700 (PDT)

On Tue, 22 Aug 2000, Suzanne Little wrote:

> Thank you very much! I've got the KjDict and deepcopies working after
> seeing your code and my function works again. :) I've only got a fairly
> superficial understanding though but as I understand the copy module the
> extra functions will only work for things that can be copied (ie: have a
> copying mechanism) and will need to be written specifically each time. Is
> this correct? So I could have problems with other entries in the __dict__
> if they aren't catered for. 

Yes, that sounds right.  The base types seems covered for copy.copy(), so
I hadn't known that copy() had that limitation.  Because the kjbuckets
stuff is an extension class, copy() doesn't know what to do with it unless
we tell it what to do.

For regular classes, copy should do fine --- copy() also covers the normal
user-defined classes.  The only things that cause difficulty with the copy
module seem to be the extension classes, so you shouldn't have too much to
worry about.

> Again thank you so much for your assistance,

No problem, that was a fun problem to chase after, and I learned a little
bit in the process... *grin*