On Friday 11 March 2005 6:08 pm, Paul F. Kunz wrote: > I ahve the following Python class defined... > > class Linear ( FunctionBase ) : > def __init__ ( self, other = None ) : > if other : > FunctionBase.__init__( self, other ) > print "copy" > self.initialize () > else: > FunctionBase.__init__( self ) > print "default" > self.initialize () > > def clone ( self ) : > print "clone" > return Linear ( self ) > > > with some member functions not shown. The class FunctionBase is a C++ > abstract base class interfaced via FunctionBase.sip It appears that > after clone() calls the copy constructor (speaking in C++ terms), the > C++ object is deleted.
Which C++ object? The original, or the clone? > How do I prevent that? Or am I trying to > clone the function in an in correct way (I know C++ better than > Python)? Clone the function? I assume you mean clone the instance. There is nothing obviously wrong with the Python. You can try building your module with tracing enabled (sip -r) to see exactly when the C++ dtors are being called. Phil _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde