
FYI, the classes that are passed by reference all subclass from otf::WrapPy<>, and you effectively get a reference to the C++ instance in the Python instance. For other classes you get a copy of the C++ instance, but get normal Python reference semantics on the result. Ignore the "WRAP CLASS" comment, it is for wrapping classes that are not in the target namespace. - Greg On Wed, 14 May 2003, Thomas Goddard wrote:
Hi Steve,
The model.openState.xform is guaranteed to be a copy of the transform object. Other Chimera objects returned as attribute lookups are also always copies, including Point, Vector, BBox. Some objects are never copied like Atom, Bond, Molecule - you always get a reference. It may be that the "WRAP CLASS" comment in the pyinterface file is what marks Xform, Point, ... as objects that are always passed by value between Chimera's Python and C++ layers. Greg Couch (gregc@cgl.ucsf.edu) is the one who would know if this is right.
I will be implementing an "undo move" menu item. I think many people will appreciate that.
Tom
Date: Wed, 14 May 2003 01:20:26 -0500 (CDT) From: Steve Ludtke <stevel@blake.3dem.bioch.bcm.tmc.edu> Reply-To: sludtke@bcm.tmc.edu To: Thomas Goddard <goddard@cgl.ucsf.edu>
Hi again. Thanks for that include file. It's been answering most of my questions. I'm putting something together I like quite a lot, and I've taken care of the problem that was making me wish for an undo. As part of this, though, I've come up with a technical question. What are the copying semantics for Xform objects ? ie -
mx=mod.openState.xform (user rotates model) mx still has the original value
This is good, but counter to the typical behavior of objects in python. That is, I would expect mx to point to an Xform object, and as long as the same Xform object gets reused when the model is rotated, I should see the rotated values rather than the original values. I'm not complaining, what it does is actually what I'd like it to do. The question is, can I rely on this behavior, or do I need to make a copy of the Xform object to make sure it won't change on me. Is it just happenstance that a new object is getting created upon rotation ? If I need to make a copy, how should I do it ? Will normal deep-copying python methods work ?
As usual. Thanks for the assistance. Perhaps I'll produce something to our mutual benefit :^)
-- ---------------------------------------------------------------------------- Steven Ludtke, PhD | Baylor College of Medicine sludtke@bcm.tmc.edu | Co-Director stevel@alumni.caltech.edu | National Center For Macromolecular Imaging V: (713)798-6989 | Dept of Biochemistry and Mol. Biol. instant messenger: sludtke42 | * Those who do ARE * http://ncmi.bcm.tmc.edu/~stevel | The converse also holds
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev