I am wondering, what is the best way to write a Python module as an interface to a C++ class? I don't want the C++ object representing the class to be declared as a global, because then if multiple instances in Python would be created, they would be using the same C++ object instance, correct?
So it seems to me that there has to be a way to create an object, and stick it in PyObject *self, since that is passed as an argument to each function making up the Python module. Then, if multiple instances of the Python object would be created, they would be referencing different C++ objects on the back end. Thoughts? So something like this: static PyObject* module_function(PyObject *self, PyObject *args) { MyCrazyCPPObject myobj; self.add(myobj); return Py_Something; } -- http://mail.python.org/mailman/listinfo/python-list