making a deepcopy of an ExtensionClass instance?
22 Nov
2000
22 Nov
'00
4:11 p.m.
The only way I've found to do this thus far is to add the following method to classes which I want to have deepcopyable instances: def __deepcopy__(self,memo): self=getattr(self,'aq_base',self) new=cPickle.loads(cPickle.dumps(self)) new.__dict__=copy.deepcopy(self.__dict__,memo) return new using cPickle like that seems really slow and ugly, and requiring that every class that might be deepcopied at the very least inherits from a mixin is less than optimal. Does anyone have a better solution? Thanks, Toby. -- [ Toby Sargeant : Inpharmatica : Developer : t.sargeant@inpharmatica.co.uk ] [ http://www.inpharmatica.co.uk : 020 7631 4644 fax 020 7631 4844 ]
9289
Age (days ago)
9289
Last active (days ago)
0 comments
1 participants
participants (1)
-
Toby Sargeant