[C++-sig] PyObject * self member in class wrappers.
David Sankel
camio at yahoo.com
Wed Jan 8 18:35:16 CET 2003
When a python class is being inherited from a c++
class, one must write a c++ wrapper around the c++
class.
This wrapper must have a pointer to a PyObject called
self.
I was wondering, what exactly is this PyObject?
Say I have the following scenario:
class Cloneable
{
public:
virtual Cloneable * Clone()=0;
};
class PythonCloneable
{
public:
PyObject * self;
PythonCloneable( PyObject * self_ ) : self(self_) {}
Cloneable * Clone()
{
PythonCloneable * theCopy;
//... What goes here?
return theCopy;
}
};
I would like Clone to return a copy (not instance) of
the original. This way, both the clone and the
original could be modified independently. How would I
manipulate the self member to do this?
Thanks,
David J. Sankel
More information about the Cplusplus-sig
mailing list