[PyKDE] Deep copy

Frederick Polgardy Jr polgardy at bodacion.com
Tue Jul 22 16:06:00 BST 2003


On Monday 21 July 2003 08:18 pm, Vio wrote:
> Hi,
> I need to implement copy/cut/paste of whole Pyqt objects. This
> apparently requires 'deep copies' of a target object: one initial
> copy used as the 'clipboard' object (my cookie-cutter), then all
> other copies created by 'deep-copying' the clipboard object.

Why not "cut" or "copy" into some kind of property map which you can use 
for construction of new objects?  You wouldn't necessarily need a 
prototype "clipboard" object, though it would probably suffice.  I 
wonder how much help you can elicit from the introspection attributes 
(__dict__, etc.) to aid in your cause.  Clearly, what you want are the 
"simpler" attributes (numbers, strings, rects, colors, etc.), not 
things like handles or references, which are either unique, or totally 
unimportant.

Also how much of this "copy construction" are you doing, that 
construction and member copying on the new instance would be so costly?  
Cut/copy/paste is normally a human-time operation, and no human is 
going to be able to tell the difference.

Good luck....
Fred




More information about the PyQt mailing list